clang::tidy PagesJaunes rules  1.0
Rules for manipulating PagesJaunes eSQL requests
buffer_split.test.h
Go to the documentation of this file.
1 const char *bigbuf = "/*-------------------------------Identification-------------------------------*/\n" \
2  "/** Sardane EasyDoc 02.1 **/\n" \
3  "#ifndef LINT\n" \
4  "#define __WATINCLUDE__ \"GIVMiseEnFormeEpj.pc\"\n" \
5  "#ifdef __TIMESTAMP__ \n" \
6  " #define WhatStampGIVMiseEnFormeEpj_pc \"@(#)SARDANE $Revision: 3.132 $ GIVMiseEnFormeEpj.pc \" \"(\" __TIMESTAMP__ \"-\" __DATE__ \" \" __TIME__ \")\"\n" \
7  "#endif /* __TIMESTAMP__ */\n" \
8  "const char* WhatIdentGIVMiseEnFormeEpj_pc(void)\n" \
9  "{\n" \
10  " const char* WhatGIVMiseEnFormeEpj_pc = WhatStampGIVMiseEnFormeEpj_pc;\n" \
11  " return (WhatGIVMiseEnFormeEpj_pc);\n" \
12  "}\n" \
13  "#endif /* LINT */\n" \
14  "/*---------------------------Fin de l'identification--------------------------*/\n" \
15  "\n" \
16  "/*----------------------------------Includes----------------------------------*/\n" \
17  "#include <stdio.h>\n" \
18  "#include <stdlib.h>\n" \
19  "#include <ctype.h>\n" \
20  "#include <errno.h>\n" \
21  "#include <time.h>\n" \
22  "#include <sys/time.h>\n" \
23  "#include <memory.h>\n" \
24  "#include <sys/types.h>\n" \
25  "#include <sys/stat.h>\n" \
26  "#include <string.h>\n" \
27  "#include <iconv.h>\n" \
28  "\n" \
29  "/* HAL, 13/11/2008 : modif pour Linux */\n" \
30  "/* Ce qui suit concernant \"oci.h\" a été lu sur \"Oracle MetaLink\" (Doc ID: NOTE:90169.1) */\n" \
31  "/* Le fichier \"oci.h\" se trouve sous \"$ORACLE_HOME/rdbms/public\" */\n" \
32  "/* The following 3 lines avoid inclusion of oci.h during precompilation */\n" \
33  "/* oci.h is needed only during compilation to resolve calls generated by the precompiler */\n" \
34  "#ifndef ORA_PROC\n" \
35  " #include <oci.h>\n" \
36  "#endif\n" \
37  "\n" \
38  "EXEC SQL begin declare section;\n" \
39  " EXEC SQL include \"GIVTypes.h\";\n" \
40  "EXEC SQL end declare section;\n" \
41  "\n" \
42  "#include \"GWCIdenObjetPub.h\"\n" \
43  "#include \"GHTgestion_compteurs.h\"\n" \
44  "#include \"GWTTrace.h\"\n" \
45  "#include \"GWDrElemTypeT.h\"\n" \
46  "\n" \
47  "#include \"GYBconstantes.h\"\n" \
48  "EXEC SQL begin declare section;\n" \
49  " EXEC SQL include \"GYBstruct_C.h\";\n" \
50  " #include \"GYBrLvsSeoEtabT.h\"\n" \
51  " #include \"GYBrPhotosEtabT.h\"\n" \
52  " #include \"GYBrLienEtabT.h\"\n" \
53  " #include \"GYBrPrioCRCT.h\"\n" \
54  " #include \"GYBrBlocT.h\"\n" \
55  " #include \"GYBrIaprofT.h\"\n" \
56  " #include \"GYBrIeinscT.h\"\n" \
57  " #include \"GYBrIndIeinscT.h\"\n" \
58  " #include \"GYBrIndIaprofT.h\"\n" \
59  " #include \"GYBrIamicT.h\"\n" \
60  " #include \"GYBrIapartT.h\"\n" \
61  " #include \"GYBrDenomSynoT.h\"\n" \
62  " #include \"GYBrPeEtabT.h\"\n" \
63  " #include \"GYBrIndPeEtabT.h\"\n" \
64  " #include \"GYBrPelrepT.h\"\n" \
65  " #include \"GYBrIndIamicT.h\"\n" \
66  " #include \"GYBrLjdeptT.h\"\n" \
67  " #include \"GYBrPelzuT.h\"\n" \
68  " #include \"GYBrIndPelzuT.h\"\n" \
69  " #include \"GYBrIndLjdeptT.h\"\n" \
70  "EXEC SQL end declare section;\n" \
71  "#include \"GIVConstantesBloc.h\"\n" \
72  "#include \"GYBrParam_erreurT.h\"\n" \
73  "#include \"GYBinterface_SGBDR.h\"\n" \
74  "\n" \
75  "EXEC SQL begin declare section;\n" \
76  " EXEC SQL include \"GYBstruct_Pro_C.h\";\n" \
77  " EXEC SQL include \"GYBindicatrices.h\";\n" \
78  " #include \"GYBrIndLvsSeoEtabT.h\"\n" \
79  " #include \"GYBrIndPhotosEtabT.h\"\n" \
80  " #include \"GYBrIndLienEtabT.h\"\n" \
81  " #include \"GYBrIndPelrepT.h\"\n" \
82  " #include \"GYBrPeadrT.h\"\n" \
83  " #include \"GYBrIndPeadrT.h\"\n" \
84  " EXEC SQL include \"GYBgestion_pro_c.h\";\n" \
85  "EXEC SQL end declare section;\n" \
86  "\n" \
87  "#include \"GBZConstantes.h\"\n" \
88  "#include \"GXWDonnees.h\"\n" \
89  "#include \"GBErRefMvtT.h\"\n" \
90  "#include \"GBERetourFournisseur.h\"\n" \
91  "\n" \
92  "#include \"GWCrStructTLVT.h\"\n" \
93  "#include \"GWCStructTLV.h\"\n" \
94  "\n" \
95  "#include \"GIXConstantes.h\"\n" \
96  "#include \"GIXVariables.h\"\n" \
97  "#include \"GWZTypeChamp.h\"\n" \
98  "\n" \
99  "#include \"GIVConstantes.h\"\n" \
100  "#include \"GIVProfFnmpT.h\"\n" \
101  "#include \"GIVProfT.h\"\n" \
102  "#include \"GIVNoyauT.h\"\n" \
103  "#include \"GIVModuleT.h\"\n" \
104  "#include \"GIVObjMicroT.h\"\n" \
105  "#include \"GYBrPaysT.h\"\n" \
106  "#include \"GYBrIndPaysT.h\"\n" \
107  "#include \"GYBrIndIapartT.h\"\n" \
108  "#include \"GIVrGeocodT_Bloc.h\"\n" \
109  "#include \"GYBrIndPecdexT.h\"\n" \
110  "#include \"GYBrPecdexT.h\"\n" \
111  "#include \"GYBrPevrepT.h\"\n" \
112  "#include \"GYBrIndPevrepT.h\"\n" \
113  "#include \"GYBrIndPaprofT.h\"\n" \
114  "#include \"GYBrPaprofT.h\"\n" \
115  "#include \"GIVDoublesInsT.h\"\n" \
116  "#include \"GIVDoublesT.h\"\n" \
117  "#include \"GIVVariables.h\"\n" \
118  "#include \"GIMTraiteAdr.h\"\n" \
119  "#include \"GIVBouclerEpj.h\"\n" \
120  "#include \"GYBrIndIadresT.h\"\n" \
121  "#include \"GYBrIadresT.h\"\n" \
122  "#include \"GYBrIaparuT.h\"\n" \
123  "#include \"GIVMiseEnFormeMvtCDBloc.h\"\n" \
124  "#include \"GHHrDataAuthentT.h\"\n" \
125  "#include \"GHHrStructFichierT.h\"\n" \
126  "#include \"GHHrStructAuthentT.h\"\n" \
127  "#include \"GHHCoherence.h\"\n" \
128  "#include \"GYBrMouvementsBlocT.h\"\n" \
129  "#include \"GEDrDescStdT.h\"\n" \
130  "#include \"GWDrPhraT.h\"\n" \
131  "#include \"GIVBlocsDoubles.h\"\n" \
132  "#include \"GYBrMouvementsT.h\"\n" \
133  "#include \"GIVLectureTabIAPROFBloc.h\"\n" \
134  "#include \"GDQQualification.h\"\n" \
135  "#include \"enumGYB.h\"\n" \
136  "#include \"enumGWZ.h\"\n" \
137  "#include \"enumGeo.h\"\n" \
138  "\n" \
139  "#ifndef ORA_PROC\n" \
140  "# include <string>\n" \
141  "# include <sstream>\n" \
142  "#endif\n" \
143  "\n" \
144  "#define SQLCA_STORAGE_CLASS extern\n" \
145  "EXEC SQL include sqlca;\n" \
146  "#define ORACA_STORAGE_CLASS extern\n" \
147  "EXEC SQL include oraca;\n" \
148  "\n" \
149  "/*-----------------------------Constantes internes----------------------------*/\n" \
150  "#define givRecreerCD \"CRE\"\n" \
151  "#define givcR00000000 \"00000000\"\n" \
152  "#define givcR000000 \"000000\"\n" \
153  "#define givcTypNoyau 'P'\n" \
154  "#define givcTypModule 'M'\n" \
155  "#define givcNogrou \"0000000\"\n" \
156  "#define givtcMoteur \"MONGO\"\n" \
157  "#define GIV_GRO_DEFAUT \"0\"\n" \
158  "\n" \
159  "#define GIV_CHAR_BLANC ' '\n" \
160  "#define givcIndInitPre 1 /* index de l'octet parution prenom */\n" \
161  "#define givcIndParuAdr 2 /* index de l'octet parution adresse */\n" \
162  "#define givcIndParuNoParu 3 /* index de l'octet parution numéro */\n" \
163  "#define givcParuAdr '0' /* valeur parution adresse normale */\n" \
164  "#define givcParuSSAdr '1' /* valeur parution sans adresse */\n" \
165  "#define givcParuSSNo '2' /* valeur parution sans numéro dans la voie */\n" \
166  "#define givcParuIPre '1' /* valeur parution initiale */\n" \
167  "#define givcParuSSNoParu '3' /* valeur parution sans numéro de parution */\n" \
168  "#define givcParuSante '0' /* valeur parution santé par defaut */\n" \
169  "#define givcParuMed 'm' /* valeur parution santé pour médecin */\n" \
170  "#define givcParuCab 'c' /* valeur parution santé pour cabinet */\n" \
171  "#define givcSuppCham '3' /* valeur support chamois */\n" \
172  "\n" \
173  "#define givcLocFictive \"99999\" /* code loc d'une localité ficitve */\n" \
174  "#define givcLocIndf \"00000\" /* code loc d'une localité indéfinie */\n" \
175  "#define givcDepPays \"500\" /* code loc d'une localité ficitve */\n" \
176  "#define givcDepFictif \"952\"\n" \
177  "#define givTrad \"&amp;\" /* traduction caractère & */\n" \
178  "#define givtcMaxAud \"MA\" /* maxi audience */\n" \
179  "#define givtcNatureAn8Part \"GPB\" /* nature parution rubrique */\n" \
180  "\n" \
181  "/* Pour les sauts de lignes */\n" \
182  "#define SEPARE_LIGNE 0x0D\n" \
183  "#define LINE_FEED 0x0A\n" \
184  "\n" \
185  "#define GIV_TAILLE_MAX_EPJ 5000\n" \
186  "#define MAX_PARENT 1000 /* par bloc nombre max de partenaires d'un parent */\n" \
187  "#define MAX_LIST_CRC 4000 /* par fichier contenu nombre max de CRC */\n" \
188  "#define MAX_LIST_CONT 2500 /* par bloc contenu nombre max de contenu d'établissement */\n" \
189  "#define giv_LG_REQUETE 512\n" \
190  "#define giv_DIV_PAR_DIX 16\n" \
191  "\n" \
192  "#define giv_LG_CLOB 65500-1 /* taile de lecture d'un clob en varchar */\n" \
193  "#define giv_LG_BUFFTEST 4000000 /* taille max de bloc complet pour le moteur */\n" \
194  "\n" \
195  "#define giv_DEP_MONACO \"006\"\n" \
196  "#define giv_LOC_MONACO \"16200\"\n" \
197  "\n" \
198  "/* données-contenus */\n" \
199  "#define giv_ENR \"ENR\" /* enrichies */\n" \
200  "#define giv_ADD \"ADD\" /* additionnelles */\n" \
201  "#define giv_ADG \"ADG\" /* additionnelles GC-EN */\n" \
202  "#define giv_REL \"REL\" /* réseaux-relais-colis */\n" \
203  "#define giv_ANN \"ANN\" /* annonceur */\n" \
204  "#define giv_EPJ \"EPJ\" /* établissement */\n" \
205  "#define giv_ANO \"ANO\" /* établissement annoté */\n" \
206  "#define giv_HPN \"HPN\" /* infos horaires payanets normalisées */\n" \
207  "#define giv_HGN \"HGN\" /* infos horaires gratuites normalisées */\n" \
208  "#define giv_PHO \"PHO\" /* photos */\n" \
209  "#define giv_CAL \"CAL\" /* calendrier */\n" \
210  "#define giv_PRT \"PRT\" /* partenaire */\n" \
211  "\n" \
212  "/* source de données additionnelles */\n" \
213  "#define giv_GCEN \"GC-EN\" /* additionnelles GC-EN */\n" \
214  "\n" \
215  "/* origine des partenaires */\n" \
216  "#define giv_ACCO \"ACCO\"\n" \
217  "#define giv_RESA \"RESA\"\n" \
218  "#define giv_EXPD \"EXPD\"\n" \
219  "#define giv_B2B \"B2B\"\n" \
220  "#define giv_CHRO \"CHRO\"\n" \
221  "#define giv_PJDC \"PJDC\"\n" \
222  "#define giv_cPJDC 'c'\n" \
223  "#define giv_orPJDC 'o'\n" \
224  "#define giv_svPJDC 's'\n" \
225  "#define giv_prPJDC 'p'\n" \
226  "#define giv_sPJDC \"LP\"\n" \
227  "#define giv_ssPJDC \"CR\"\n" \
228  "#define giv_sRKPJDC \"3R\"\n" \
229  "#define giv_cCHRO 'c'\n" \
230  "#define giv_sCHRO \"LC\"\n" \
231  "#define giv_ssCHRO \"CH\"\n" \
232  "#define giv_cLEUR 'l'\n" \
233  "\n" \
234  "namespace GIV\n" \
235  "{\n" \
236  "enum givcParu\n" \
237  "{\n" \
238  " giv_RUB = 0, giv_DNOM = 1, giv_OBJ = 2\n" \
239  "};\n" \
240  "}\n" \
241  "\n" \
242  "#define givTitreDoc \"Dr \"\n" \
243  "\n" \
244  "/* Requete de lecture du texte correspondant l'AN9 */\n" \
245  "#define GIVRequeteLectureRJRUPR \\\n" \
246  "\"select lasan9 \\\n" \
247  " from rjrupr \\\n" \
248  " where codan9 = :codeAn9\"\n" \
249  "\n" \
250  "/* Requete de lecture du theme correspondant l'AN9 */\n" \
251  "#define GIVRequeteLectureThemeED \\\n" \
252  "\"select theme \\\n" \
253  " from GYTtabThemeED \\\n" \
254  " where codan9 = :codeAn9\"\n" \
255  "\n" \
256  "/* Requete de lecture du type d'URL */\n" \
257  "#define GIV_RQ_SELECT_TYPE_URL \\\n" \
258  "\"select unique tpdurl,liburl from GYTtabPemicURL \\\n" \
259  "where (numobj = :numobj \\\n" \
260  "and typobj = :typobj \\\n" \
261  "and tpdsob = :tpdsob1 \\\n" \
262  ")\"\n" \
263  "\n" \
264  "/* Requete de lecture des données de l'établissement de niveau inscription */\n" \
265  "#define GIV_RQ_SELECT_ETAB_MC \\\n" \
266  "\"select siret, url, tefet, tefen, siege, cj, libcj, libape, datcrent from GYTTabPeEtab \\\n" \
267  "where etab = :etab\"\n" \
268  "\n" \
269  "#define GIV_RQ_SELECT_SIREN \\\n" \
270  "\"select to_char(count(etab),'FM00000') from GYTTabPeEtab where substr(siret,1,9) = substr(:siren,1,9)\"\n" \
271  "\n" \
272  "/* Requete de lecture des données de l'établissement */\n" \
273  "#define GIV_RQ_SELECT_ETAB \\\n" \
274  "\"select denom, nomdirig, parut_insee, siret_rs, siret_rscompl, siret_enseigne, siret_sigle, opp_photo from GYTTabPeEtab \\\n" \
275  "where etab = :etab\"\n" \
276  "\n" \
277  "/* Requete de lecture des dénominations secondaires de l'établissement */\n" \
278  "#define GIV_RQ_SELECT_DENOM_ETAB \\\n" \
279  "\"select origine,denom from GYTTabDenomsEtab \\\n" \
280  "where etab = :etab\"\n" \
281  "\n" \
282  "/* Requete de lecture des photos de l'établissement */\n" \
283  "#define GIV_RQ_SELECT_PHOTOS_ETAB \\\n" \
284  "\"select x.photo, x.legende, x.cteutil, x.origine, x.metadata.getClobVal() from GYTTabPhotosEtab x \\\n" \
285  "where etab = :etab\"\n" \
286  "\n" \
287  "/* Requete de lecture des objets pub de l'établissement */\n" \
288  "#define GIV_RQ_SELECT_PUB_ETAB \\\n" \
289  "\"select epjobj,tpdsob,stobj,numobj,(TO_CHAR (datact,'FXYYYYMMDD')) from GYTTabEpjMic \\\n" \
290  "where etab = :etab and upper(tpdsob) = tpdsob and tpdsob||stobj != 'FAPK' \\\n" \
291  "union select a.epjobj,a.tpdsob,a.stobj,a.numobj,(TO_CHAR (datact,'FXYYYYMMDD')) from GYTTabEpjMic a, GYTtabProduitGPPParut b \\\n" \
292  "where a.etab = :etab and upper(a.tpdsob) = a.tpdsob and a.tpdsob||a.stobj = 'FAPK' \\\n" \
293  "and b.numobj = a.epjobj and nls_upper(b.tpdsob) = nls_upper(a.tpdsob) \\\n" \
294  "and ((b.datedeb is null) or (to_char(b.datedeb,'YYYYMMDD') <= to_char(current_date,'YYYYMMDD'))) \\\n" \
295  "and ((b.datefin is null) or (to_char(current_date,'YYYYMMDD') <= to_char(b.datefin,'YYYYMMDD'))) \\\n" \
296  "union select '',tpdsob,stobj,'','' from View_EPJProduitsFictifs \\\n" \
297  "where etab = :etab\"\n" \
298  "\n" \
299  "/* Requete de lecture du calendrier de partenaire */\n" \
300  "#define GIV_RQ_SELECT_CALEND_PART \\\n" \
301  "\"select XMLSERIALIZE(Document XMLTYPE(x.complement.extract('/complement/complement_pjdocclicrdv/calendrier').getClobVal()) AS CLOB INDENT SIZE = 0) \\\n" \
302  " from GYTTabPartEtab x \\\n" \
303  " where x.origine = :origine and x.refext = :refext \\\n" \
304  " and existsNode(x.complement,'/complement/complement_pjdocclicrdv/calendrier') = 1\"\n" \
305  "\n" \
306  "/* Requete de lecture des photos de partenaire */\n" \
307  "#define GIV_RQ_SELECT_PHOTO_PART \\\n" \
308  "\"select XMLSERIALIZE(Document XMLTYPE(x.photos.extract('/photos/photo').getClobVal()) AS CLOB INDENT SIZE = 0) \\\n" \
309  " from GYTTabPartEtab x \\\n" \
310  " where x.origine = :origine and x.refext = :refext \\\n" \
311  " and existsNode(x.photos,'/photos/photo') = 1\"\n" \
312  "\n" \
313  "/* Requete de lecture des données de l'établissement */\n" \
314  "#define GIV_RQ_SELECT_PEETAB \\\n" \
315  "\"select \\\n" \
316  "etab,siret,ape, \\\n" \
317  "denom,compln, \\\n" \
318  "coddep,codloc,libloc, \\\n" \
319  "codvoi,typvoi,libvoi,novoie,cplnov, \\\n" \
320  "longitude,latitude,precision \\\n" \
321  "from GYTtabPeEtab \\\n" \
322  "where (etab = :etab)\"\n" \
323  "\n" \
324  "/* Requete de lecture des URL d'un établissement Grand Compte */\n" \
325  "#define GIV_RQ_SELECT_PUB_GCPT \\\n" \
326  "\"select liburl from GYTTabURLGCpt \\\n" \
327  "where etab = :etab\"\n" \
328  "\n" \
329  "/* Requete de lecture des anciens établissements */\n" \
330  "#define GIV_RQ_SELECT_OLD_ETAB \\\n" \
331  "\"select etarepri,typrepri,(TO_CHAR (datelien,'FXYYYYMMDD')) dat from GYTTabLiensEtab \\\n" \
332  "where etab = :etab order by dat\"\n" \
333  "\n" \
334  "/* Requete de lecture des liens vers site de SEO */\n" \
335  "#define GIV_SLC_LVS_SEO_ETAB \"\\\n" \
336  " select idstat,partseo,urlseo,ancre,follow,ordre \\\n" \
337  " from gyttablvsseoetab \\\n" \
338  " where etab = :pcOraEtab\"\n" \
339  "\n" \
340  "/* Requete de lecture des liens vers les produits à l'epj */\n" \
341  "#define GIV_SLC_LIENS_PROD_ETAB \"\\\n" \
342  " select tpdsob,stobj,epjobj,cle,valeur \\\n" \
343  " from gyttabprodliensetab \\\n" \
344  " where etab = :pcOraEtab\"\n" \
345  "\n" \
346  "/* Requete de lecture de Ref Embauche */\n" \
347  "#define GIV_RQ_SELECT_EMBAUCHE \\\n" \
348  "\"select refext from GYTTabEmbauche \\\n" \
349  "where numcli = :numcli\"\n" \
350  "\n" \
351  "#define GIV_RQ_SELECT_BONPLAN_PUB \\\n" \
352  "\"select etab,(TO_CHAR (date_fin,'FXYYYYMMDD')),TO_CHAR(nb_bp,'FM99999'),tpdsob,decode(tpdsob,'E+',1,'EB',2,'C+',3,'CB','4','G+',5,'GB',6,7),numcli from GYTTabBonPlan \\\n" \
353  "where etab = :etab \\\n" \
354  "union select b.etab,(TO_CHAR (b.date_fin,'FXYYYYMMDD')),TO_CHAR(b.nb_bp,'FM99999'),b.tpdsob,decode(b.tpdsob,'E+',1,'EB',2,'C+',3,'CB','4','G+',5,'GB',6,7),numcli from GYTTabEpjMic a, GYTTabBonPlan b \\\n" \
355  "where a.etab = :etab and b.numcli = substr(a.numobj,5,8) and b.numprod = substr(a.numobj,13,4) and b.tpdsob = a.tpdsob \\\n" \
356  "order by 002 desc,003 desc,005,006\"\n" \
357  "\n" \
358  "#define GIV_RQ_SELECT_IMAG \\\n" \
359  "\"select to_char(nbimag),to_char(imagcat),imagmenu from GYTTabPvImag \\\n" \
360  "where numobj = :numobj\"\n" \
361  "\n" \
362  "#define GIV_RQ_SELECT_STAT \\\n" \
363  "\"select estatan from GYTTabEStatAn \\\n" \
364  "where numcli = :numcli\"\n" \
365  "\n" \
366  "/* Requete de lecture de EvIlo */\n" \
367  "#define GIV_RQ_SELECT_EVILO \\\n" \
368  "\"select evt, prg from GYTTabEvIlo \\\n" \
369  "where etab = :etab\"\n" \
370  "\n" \
371  "/* Requete de lecture du type de Siret Pages Pro */\n" \
372  "#define GIV_RQ_SELECT_SIRET \\\n" \
373  "\"select siret from GYTtabPagesPro \\\n" \
374  "where (siret = :siret)\"\n" \
375  "\n" \
376  "/* libellé de localité de rattachement */\n" \
377  "#define GIV_RQ_SELECT_LIB_LJLORN \\\n" \
378  "\"select distinct a.liblae \\\n" \
379  "from GYTtabPelrep a, LJLORN b\\\n" \
380  " where (a.depart = b.cdsdep and a.numloc = b.numloc \\\n" \
381  " and (a.arrond = '00' or a.arrond = '99')) \\\n" \
382  " and (b.cddprn = :depart and b.nulorn = :numloc)\"\n" \
383  "\n" \
384  "/* localités par département */\n" \
385  "#define GIV_RQ_SELECT_LOC_DEP \\\n" \
386  "\"select numloc \\\n" \
387  "from GYTtabPelrep where depart = :depart and numloc != '99999'\"\n" \
388  "\n" \
389  "/* GIV_RQ_SELECT_ZU : texte SQL de la requete de recherche Zone Urbaine */\n" \
390  "\n" \
391  "#define GIV_RQ_SELECT_ZU \\\n" \
392  "\"select deppole,locpole \\\n" \
393  "from GYTtabPelzu\\\n" \
394  " where depart = :depart and localite = :numloc\"\n" \
395  "\n" \
396  "#define GIV_RQ_SELECT_ZU_POLE \\\n" \
397  "\"select deppole,locpole \\\n" \
398  "from GYTtabPelzu\\\n" \
399  " where depart = :depart and localite = :numloc\\\n" \
400  " and depart = deppole and localite = locpole\"\n" \
401  "\n" \
402  "#define GIV_RQ_SELECT_ZU_LF \\\n" \
403  "\"select deppole,locpole \\\n" \
404  "from GYTtabPelzu\\\n" \
405  " where depart = :depart and localite = :numloc\"\n" \
406  "\n" \
407  "/* GIV_RQ_SELECT_LOCFUS : texte SQL de la requete de recherche de localité fusionnée */\n" \
408  "\n" \
409  "#define GIV_RQ_SELECT_LOCFUS \\\n" \
410  "\"select depfus,locfus \\\n" \
411  "from GYTtabPelFusion \\\n" \
412  " where depart = :depart and localite = :numloc\"\n" \
413  "\n" \
414  "#define GIV_RQ_SELECT_REGION \\\n" \
415  "\"select cdsreg \\\n" \
416  "from ljdept\\\n" \
417  " where cdsdep = :depart\"\n" \
418  "\n" \
419  "#define GIV_RQ_SELECT_NEW_REGION \\\n" \
420  "\"select cdsreg, cdrgol \\\n" \
421  "from ljdept\\\n" \
422  " where cdsdep = :depart\"\n" \
423  "\n" \
424  "#define GIV_RQ_SELECT_CRC \\\n" \
425  "\"select codecrc,libelcrc,navigateur \\\n" \
426  "from donneescrc\\\n" \
427  " where depart = :depart and numloc = :numloc and numnat = :numnat \\\n" \
428  " and codan9 = :codan9\"\n" \
429  "\n" \
430  "#define GIV_RQ_SELECT_ANC_BLOC \"\\\n" \
431  "select substr(blocid,1,length(blocid)-1)||'C000'||substr(blocid,length(blocid),1) \\\n" \
432  " from VueTabMvtsBloc_%s_%s_%s\\\n" \
433  " where (depart = %s) and (numnat = :numnat) and (numlo = :numlo) and (numls = :numls) and (substr(blocid,1,4) != 'C000') and blocid is not null\"\n" \
434  "\n" \
435  "/* acces GYTtabIeBlocCRC_dest */\n" \
436  "\n" \
437  "#define GIV_DEL_IEBLOC_CRC \"\\\n" \
438  " delete from GYTtabieBlocEpjCRC_%s\\\n" \
439  " where (blocid = :cBlocid)\"\n" \
440  "\n" \
441  "#define GIV_INS_IEBLOC_CRC \"\\\n" \
442  " insert into GYTtabIeBlocEpjCRC_%s\\\n" \
443  " (blocid,etab,crc,type,codan8,origine,version)\\\n" \
444  " values (:acBlocid,\\\n" \
445  " :acEtab,\\\n" \
446  " :acCrc,\\\n" \
447  " nvl(:acType,'X'),\\\n" \
448  " :acCodan8,\\\n" \
449  " :acTpdsob,\\\n" \
450  " :version)\"\n" \
451  "\n" \
452  "/* acces GYTtabIeBloc_dest */\n" \
453  "\n" \
454  "#define GIV_DEL_IEBLOC \"\\\n" \
455  " delete from GYTtabIeBlocEpj_%s\\\n" \
456  " where (depart = :cDepart) and (blocid = :cBlocid)\"\n" \
457  "\n" \
458  "#define GIV_CRE_IS \"\\\n" \
459  " insert into GYTtabIeBlocEpj_%s\\\n" \
460  " (depart,numnat,numlo,numls,blocid,etab,nogrou,noselo,nosels,datemodbloc,version)\\\n" \
461  " values (:acDepart,\\\n" \
462  " :acNumnat,\\\n" \
463  " :acNumlo,\\\n" \
464  " :acNumls,\\\n" \
465  " :acBlocid,\\\n" \
466  " :acEtab:indicatrice_acEtab, \\\n" \
467  " :acNogrou:indicatrice_acNogrou,\\\n" \
468  " :acNoselo:indicatrice_acNoselo,\\\n" \
469  " :acNosels:indicatrice_acNosels,\\\n" \
470  " (TO_DATE (:acDatemodbloc,'FXYYYYMMDD')),\\\n" \
471  " :version)\"\n" \
472  "\n" \
473  "#define GIV_CRE_IG \"\\\n" \
474  " insert into GYTtabIeBlocEpj_%s\\\n" \
475  " (depart,numnat,numlo,numls,blocid,etab,nogrou,noselo,nosels,datemodbloc,version)\\\n" \
476  " values (:acDepart,\\\n" \
477  " :acNumnat,\\\n" \
478  " :acNumlo,\\\n" \
479  " :acNumls,\\\n" \
480  " :acBlocid,\\\n" \
481  " :acEtab:indicatrice_acEtab, \\\n" \
482  " :acNogrou:indicatrice_acNogrou,\\\n" \
483  " :acNoselo:indicatrice_acNoselo,\\\n" \
484  " :acNosels:indicatrice_acNosels,\\\n" \
485  " (TO_DATE (:acDatemodbloc,'FXYYYYMMDD')),\\\n" \
486  " :version)\"\n" \
487  "\n" \
488  "#define GIV_SLC_CLOB_DONENR \"\\\n" \
489  " select XMLSERIALIZE(Document XMLTYPE(x.donenr.extract('/donneesEnrichissement/prestationsDonneesEnrichies').getClobVal()) AS CLOB INDENT SIZE = 0) \\\n" \
490  " from gyttabpeetab x \\\n" \
491  " where x.etab = :pcOraEtab and existsNode(x.donenr,'/donneesEnrichissement/prestationsDonneesEnrichies') = 1\"\n" \
492  "\n" \
493  "#define GIV_SLC_CLOB_DONREL \"\\\n" \
494  " select x.res_relais.getClobVal() \\\n" \
495  " from gyttabpeetab x \\\n" \
496  " where x.etab = :pcOraEtab and existsNode(x.res_relais,'/lstde') = 1\"\n" \
497  "\n" \
498  "#define GIV_SLC_CLOB_DONADD_GCEN \"\\\n" \
499  "select x.info.getClobVal() \\\n" \
500  " from gyttabdonaddetab x \\\n" \
501  " where x.etab = :pcOraEtab and x.source = :pcOraSce \\\n" \
502  " and existsNode(x.info,'/listeEnseigneEpj/enseigneEpj/libelleEnseigne') = 1\"\n" \
503  "\n" \
504  "#define GIV_SLC_CLOB_DONADD \"\\\n" \
505  " select x.info.getClobVal() \\\n" \
506  " from gyttabdonaddetab x \\\n" \
507  " where x.etab = :pcOraEtab and x.source = :pcOraSce\"\n" \
508  "\n" \
509  "#define GIV_SLC_CLOB_ANNONC \"\\\n" \
510  " select x.contenu.getClobVal() \\\n" \
511  " from gyttabcontenusannonceur x \\\n" \
512  " where x.numobj = :pcObjet and x.type = :pcType\"\n" \
513  "\n" \
514  "#define GIV_SLC_TYP_CONT_ETAB \"\\\n" \
515  " select distinct type,theme \\\n" \
516  " from gyttabcontenusetab \\\n" \
517  " where etab = :pcOraEtab\"\n" \
518  "\n" \
519  "#define GIV_SLC_CONT_PROF_ETAB \"\\\n" \
520  " select distinct 'V','DV',codan8,'' from gyttabprofetab where etab = :pcOraEtab and origine = '5' \\\n" \
521  " union select distinct 'N',a.type,a.codan8,nvl(to_char(b.datefraho,'FXYYYYMMDD'),'19000101') from gyttabdhnetab a, gyttabprofetab b \\\n" \
522  " where a.etab = :pcOraEtab and b.etab = a.etab and b.origine = '5' and a.codan8 = b.codan8 \\\n" \
523  " union select distinct 'N',a.type,'',nvl(to_char(b.datefraho,'FXYYYYMMDD'),'19000101') from gyttabdhnetab a, gyttabpeetab b \\\n" \
524  " where a.etab = :pcOraEtab and b.etab = a.etab and a.type = 'DE' \\\n" \
525  " union select distinct 'S',a.type,a.codan8,nvl(to_char(b.datefraho,'FXYYYYMMDD'),'19000101') from gyttabdhsetab a, gyttabprofetab b \\\n" \
526  " where a.etab = :pcOraEtab and b.etab = a.etab and b.origine = '5' and a.codan8 = b.codan8 \\\n" \
527  " union select distinct 'S',a.type,'',nvl(to_char(b.datefraho,'FXYYYYMMDD'),'19000101') from gyttabdhsetab a, gyttabpeetab b \\\n" \
528  " where a.etab = :pcOraEtab and b.etab = a.etab and a.type = 'DE' \\\n" \
529  " order by 001,004 desc,002 desc,003\"\n" \
530  "\n" \
531  "#define GIV_SLC_CLOB_ETAB \"\\\n" \
532  " select y.contenu.getClobVal() \\\n" \
533  " from gyttabcontenusetab y \\\n" \
534  " where y.etab = :pcOraEtab and y.type = :pcType and nvl(:pcTheme,y.theme) = y.theme\"\n" \
535  "\n" \
536  "#define GIV_SLC_CLOB_ANNOT \"\\\n" \
537  " select z.contenu.getClobVal() \\\n" \
538  " from gyttabcontenusetab z \\\n" \
539  " where z.etab = :pcOraEtab and z.type = :pcType and z.source = :pcOraSce\"\n" \
540  "\n" \
541  "#define GIV_SLC_CLOB_DHNA \"\\\n" \
542  " select xx.contenu.getClobVal() \\\n" \
543  " from gyttabdhnannonceur xx \\\n" \
544  " where xx.type = :pcType and xx.numobj = :pcObjet\"\n" \
545  "\n" \
546  "#define GIV_SLC_CLOB_DHNE \"\\\n" \
547  " select x.contenu.getClobVal() \\\n" \
548  " from gyttabdhnetab x \\\n" \
549  " where x.etab = :pcOraEtab and x.type = :pcOraType and \\\n" \
550  " ((x.type = 'DV' and x.codan8 = :pcAn8:sInd) or \\\n" \
551  " (x.type = 'DE'))\"\n" \
552  "\n" \
553  "#define GIV_SLC_CLOB_PART \"\\\n" \
554  " select x.complement.getClobVal(), x.photos.getClobVal() \\\n" \
555  " from gyttabpartetab x \\\n" \
556  " where x.origine = :origine and x.refext = :refext\"\n" \
557  "\n" \
558  "#define GIV_SLC_MOT_CLE \"\\\n" \
559  " select b.idmotcle,b.codan8,b.terme \\\n" \
560  " from gyttabgppmotscles a, gyttabmotsclescri b \\\n" \
561  " where a.numobj = :obj and b.idmotcle = a.idmotcle \\\n" \
562  " and b.codan8 is not null\"\n" \
563  "\n" \
564  "#define GIV_RQ_SELECT_BUC \"\\\n" \
565  " select distinct numcli from gyttabieinsc_888 \\\n" \
566  " where etab = :etab and (numls >= :min) and (numls <= :max) and numcli is not null order by numcli\"\n" \
567  "\n" \
568  "/* requêtes SEO */\n" \
569  "\n" \
570  "#define GIV_RQ_SELECT_SRV_SEO \\\n" \
571  "\"select info,avis from GYTTabSEOService \\\n" \
572  "where etab = :etab %s\"\n" \
573  "\n" \
574  "#define GIV_VERS_SEO \"\\\n" \
575  " select min(decode(double,'REF',1,'RFV',2,'DBL',3,4)||blocid) \\\n" \
576  " from GYTtabIeBloc_%s\\\n" \
577  " where ((numnat = :cNumnat) \\\n" \
578  " and (numlo = :cNumlo) and (numls = :cNumls))\"\n" \
579  "\n" \
580  "#define GIV_RQ_SELECT_DNOM_PRINC \"\\\n" \
581  " select nvl(min(substr(a.inparu,3,1)||decode(a.indprf,'0',1,0)||decode(substr(a.inparu,1,1),'o',1,'s',2,'c',3,'p',4,5)||decode(a.indrecgpp,'1',0,1)||decode(c.tpdsob,'SC',decode(c.stobj,'PB',8,1),'FI',2,'VI',3,'IN',4,' T',5,'NV',6,'NT',7,8)||decode(marque,null,0,1)||decode(a.numls,'0000',1,0)||nvl(a.nogrou||a.noselo||a.nosels,'ZZZZZZZ0000000')||a.numnat||a.numlo||a.numls),'999999ZZZZZZZ0000000ZZZZZZZZZZZZZZZZZZ') from VueTabIeInsc_%s_%s_%s a,VueTabIamic_%s_%s_%s c \\\n" \
582  " where \\\n" \
583  " a.indmic = '1' \\\n" \
584  " and c.numnat = a.numnat and c.numlo = a.numlo and c.numls = a.numls \\\n" \
585  " and a.etab = :etab \\\n" \
586  " union \\\n" \
587  " select nvl(min(substr(a.inparu,3,1)||decode(a.indprf,'0',1,0)||decode(substr(a.inparu,1,1),'o',1,'s',2,'c',3,'p',4,5)||'1'||'9'||decode(marque,null,0,1)||decode(a.numls,'0000',1,0)||nvl(a.nogrou||a.noselo||a.nosels,'ZZZZZZZ0000000')||a.numnat||a.numlo||a.numls),'999999ZZZZZZZ0000000ZZZZZZZZZZZZZZZZZZ') from VueTabIeInsc_%s_%s_%s a \\\n" \
588  " where \\\n" \
589  " a.indmic = '0' \\\n" \
590  " and a.etab = :etab \\\n" \
591  " order by 001 \\\n" \
592  "\"\n" \
593  "\n" \
594  "/* oppositions et black-listes */\n" \
595  "#define GIV_RQ_SELECT_OPP_PART \\\n" \
596  "\"select opposition from GYTTabPartOpp \\\n" \
597  " where origine = :origine and refext = :refext\"\n" \
598  "\n" \
599  "#define GIV_RQ_SELECT_OPP_URLGR \\\n" \
600  "\"select codan8 from GYTTabURLGrOpp \\\n" \
601  " where etab = :etab and codan8 = :codan8\"\n" \
602  "\n" \
603  "#define GIV_RQ_SELECT_PROF_URLGR \\\n" \
604  "\"select codan8 from GYTTabURLGrProf \\\n" \
605  " where codan8 = :codan8\"\n" \
606  "\n" \
607  "#define GIV_RQ_SELECT_BL_CRC_LR \\\n" \
608  "\"select codan8 from GYTTabBListCRCLR \\\n" \
609  " where etab = :etab and codan8 = :codan8 \\\n" \
610  " and tpdsob = :tpdsob and contenu = :contenu\"\n" \
611  "\n" \
612  "#define GIV_RQ_SELECT_BL_CRC_FD \\\n" \
613  "\"select tpdsob from GYTTabBListCRCFD \\\n" \
614  " where (etab = :etab and contenu = :contenu) \\\n" \
615  " or (tpdsob = :tpdsob)\"\n" \
616  "\n" \
617  "#define GIV_RQ_SELECT_BL_EPJ_FD \\\n" \
618  "\"select etab from GYTTabBListEPJFD \\\n" \
619  " where (etab = :etab)\"\n" \
620  "\n" \
621  "#define GIV_RQ_SELECT_BL_EPJ_PROF \\\n" \
622  "\"select codan8 from GYTTabBListEPJProf \\\n" \
623  " where etab = :etab and codan8 = :codan8\"\n" \
624  "\n" \
625  "/* conflits */\n" \
626  "#define GIV_RQ_SELECT_PRIO_PROF_CRC \\\n" \
627  "\"select codan8 from GYTTabCRCProfPrio \\\n" \
628  " where codan8 = :codan8 and contenu = :contenu\"\n" \
629  "\n" \
630  "/* extra-localité proxi */\n" \
631  "#define GIV_RQ_SELECT_EXTRA_LOC_IS \"\\\n" \
632  " select b.codan8 from VueTabIeInsc_%s_%s_%s a,VueTabIaProf_%s_%s_%s b \\\n" \
633  " where b.codan8 = :codan8 \\\n" \
634  " and a.numnat = b.numnat and a.numlo = b.numlo and a.numls = b.numls \\\n" \
635  " and a.etab = :etab \\\n" \
636  " and decode(a.depact,null,decode(a.coddep,null,a.deppar,a.coddep),a.depact) = a.deppar \\\n" \
637  " and decode(a.locact,null,decode(a.codloc,null,a.locpar,a.codloc),a.locact) = decode(a.locpar,'99999',decode(a.locact,null,a.codloc,a.locact),a.locpar) \\\n" \
638  " union \\\n" \
639  " select b.codan8 from VueTabIeInsc_%s_%s_%s a,GYTtabProfEtab b \\\n" \
640  " where b.etab = :etab \\\n" \
641  " and b.codan8 = :codan8 \\\n" \
642  " and (b.origine = '4' or b.origine = '6') \\\n" \
643  " and a.etab = b.etab \\\n" \
644  " and a.numls = '0000' \\\n" \
645  " and decode(a.depact,null,decode(a.coddep,null,a.deppar,a.coddep),a.depact) = a.deppar \\\n" \
646  " and decode(a.locact,null,decode(a.codloc,null,a.locpar,a.codloc),a.locact) = decode(a.locpar,'99999',decode(a.locact,null,a.codloc,a.locact),a.locpar) \\\n" \
647  "\"\n" \
648  "#define GIV_RQ_SELECT_EXTRA_LOC_INTER_IS \"\\\n" \
649  " select a.numnat,a.numlo,a.numls \\\n" \
650  " from VueTabIeInsc_%s_%s_%s a,VueTabIaProf_%s_%s_%s b \\\n" \
651  " where b.codan8 = :codan8 \\\n" \
652  " and a.numnat = b.numnat and a.numlo = b.numlo and a.numls = b.numls \\\n" \
653  " and a.etab = :etab \\\n" \
654  " union \\\n" \
655  " select a.numnat,a.numlo,a.numls \\\n" \
656  " from VueTabIeInsc_%s_%s_%s a,GYTtabProfEtab b \\\n" \
657  " where b.etab = :etab \\\n" \
658  " and b.codan8 = :codan8 \\\n" \
659  " and (b.origine = '4' or b.origine = '6') \\\n" \
660  " and a.etab = b.etab \\\n" \
661  " and a.numls = '0000' \\\n" \
662  "\"\n" \
663  "\n" \
664  "#define GIV_RQ_SELECT_EXTRA_LOC_IO \"\\\n" \
665  "(select b.codan8 from VueTabIeInsc_%s_%s_%s a, VueTabIaProf_%s_%s_%s b \\\n" \
666  " where a.etab = :etab and a.numls != '0000' \\\n" \
667  " and (decode(a.depact,null,decode(a.coddep,null,a.deppar,a.coddep),a.depact) != a.deppar \\\n" \
668  " or decode(a.locact,null,decode(a.codloc,null,a.locpar,a.codloc),a.locact) != decode(a.locpar,'99999',decode(a.locact,null,a.codloc,a.locact),a.locpar)) \\\n" \
669  " and b.numnat = a.numnat and b.numlo = a.numlo and b.numls = a.numls \\\n" \
670  " and not exists ( \\\n" \
671  " (select h.codan8 from VueTabIaProf_%s_%s_%s h \\\n" \
672  " where h.numnat = :numnat and h.numlo = :numlo and h.numls = :numls \\\n" \
673  " union select k.codan8 from gyttabProfEtab k \\\n" \
674  " where k.etab = :etab and (k.origine = '4' or k.origine = '6')) \\\n" \
675  " minus \\\n" \
676  " (select g.codan8 from VueTabIaProf_%s_%s_%s g \\\n" \
677  " where g.numnat = b.numnat and g.numlo = b.numlo and g.numls = b.numls) ) ) \\\n" \
678  " minus (select i.codan8 from VueTabIaProf_%s_%s_%s i \\\n" \
679  " where i.numnat = :numnat and i.numlo = :numlo and i.numls = :numls \\\n" \
680  " union select j.codan8 from GYTtabProfEtab j \\\n" \
681  " where j.etab = :etab and (j.origine = '4' or j.origine = '6')) \\\n" \
682  "\"\n" \
683  "#define GIVRequeteSyno \\\n" \
684  "\"select codan8,synonymes from GyttabDenomSynonyme \\\n" \
685  "where denom = :denom\"\n" \
686  "\n" \
687  "#define GIV_SLC_LIENS_PROF_PUB \\\n" \
688  "\"select numnatrec,numlorec,numlsrec,codan8 from GYTtabIeInscRecGPP_%s \\\n" \
689  "where numnat = :numnat and numlo = :numlo and numls = :numls\"\n" \
690  "\n" \
691  "#include \"GivrEltListTEpj.h\"\n" \
692  "\n" \
693  "typedef struct\n" \
694  "{\n" \
695  " char reg[2 + 1]; /* */\n" \
696  " char dep[3 + 1]; /* */\n" \
697  " char loc[5 + 1]; /* */\n" \
698  " int4 nbarr;\n" \
699  " int4 iParuInst;\n" \
700  "} givrRefArrT;\n" \
701  "\n" \
702  "#include \"GivrRangListTEpj.h\"\n" \
703  "\n" \
704  "/* liste des codes d'installation */\n" \
705  "GivrRangListTEpj givrListInst;\n" \
706  "/* liste des codes de parution */\n" \
707  "GivrRangListTEpj givrListParu;\n" \
708  "/* codes dep/loc/arr */\n" \
709  "givrRefArrT givtrRefArr[6] =\n" \
710  "{\n" \
711  " { \"11\", \"075\", \"05600\", 20, -1 },\n" \
712  " { \"82\", \"069\", \"12300\", 9, -1 },\n" \
713  " { \"93\", \"013\", \"05500\", 16, -1 },\n" \
714  " { \"11\", \"075\", \"99999\", 20, -1 },\n" \
715  " { \"82\", \"069\", \"99999\", 9, -1 },\n" \
716  " { \"93\", \"013\", \"99999\", 16, -1 }\n" \
717  "};\n" \
718  "\n" \
719  "#include \"GivrEltListObjTEpj.h\"\n" \
720  "#include \"GivrRangListObjTEpj.h\"\n" \
721  "\n" \
722  "/* liste des objets */\n" \
723  "GivrRangListObjTEpj givrListObj;\n" \
724  "\n" \
725  "#include \"GivrRangListCRCTEpj.h\"\n" \
726  "\n" \
727  "int4 giviConflitCRC;\n" \
728  "int4 giviNbCRC;\n" \
729  "/* liste des CRC */\n" \
730  "GivrRangListCRCTEpj givrListCRC;\n" \
731  "/* type des contenus */\n" \
732  "typedef struct\n" \
733  "{\n" \
734  " char tcEtab[GYBIeinscLgEtab2]; /* etab */\n" \
735  " char tcType[GYBIamicLgTpdsob + 1]; /* type */\n" \
736  " char tcThm[GYBIamicLgTpdsob]; /* theme */\n" \
737  "} givrTypeContEtabT;\n" \
738  "/* type des contenus prof */\n" \
739  "typedef struct\n" \
740  "{\n" \
741  " char tcEtab[GYBIeinscLgEtab2]; /* etab */\n" \
742  " char tcAn8[GYBIaprofLgCodan8 + 1]; /* an8 */\n" \
743  " char tcType[3]; /* type */\n" \
744  " char cIndic; /* présence de contenu */\n" \
745  "} givrContProfEtabT;\n" \
746  "/* liste des contenus par epj */\n" \
747  "int4 giviNbContEtab;\n" \
748  "givrTypeContEtabT givrListContEtab[MAX_LIST_CONT];\n" \
749  "/* liste des contenus par epj et an8 */\n" \
750  "int4 giviNbProfEtab;\n" \
751  "givrContProfEtabT givrListProfEtab[MAX_LIST_CONT];\n" \
752  "\n" \
753  "/* description dans PartEtab */\n" \
754  "GYBrIapartT givtrPart[MAX_PARENT];\n" \
755  "GYBstrIapartCleNavT givtcCleNav[MAX_PARENT];\n" \
756  "int4 giviNbParentPart;\n" \
757  "int4 giviRefPJDC;\n" \
758  "int4 giviNbIapartPJDC;\n" \
759  "int4 giviNbTupleIapart;\n" \
760  "\n" \
761  "/*------------------------------Données exportées-----------------------------*/\n" \
762  "extern char cDate[GYBIeBlocLgDateModBloc + 1];\n" \
763  "\n" \
764  "/*------------------------------Données internes------------------------------*/\n" \
765  "static int4 giviNumFic;\n" \
766  "int4 giviEnrich = (int4)GIV::GIXCodeKO;\n" \
767  "int4 giviCodRetEcr = (int4)GIV::GIXCodeOK;\n" \
768  "nat2 usLgchamp = 0; /* longueur du champ a encoder */\n" \
769  "nat2 usSaveLg = 0; /* longueur d'un sous ensemble TLV */\n" \
770  "nat2 usSaveLgEns = 0; /* longueur d'un ensemble TLV */\n" \
771  "nat2 usLgTotale = 0;\n" \
772  "nat2 usSaveLgTot = 0; /* longueur totale du mouvement CD hors compteur de longueur*/\n" \
773  "/* GYBrParam_erreurT vErreurSQL; */\n" \
774  "char cCodope[GYBMouvementsLgCodope + 1];\n" \
775  "char cNumlot[GYBMouvementsLgNumlot + 1];\n" \
776  "char cNummvt[GYBMouvementsLgNummvt + 1];\n" \
777  "char cNumnat[GYBMouvementsLgNumnat + 1];\n" \
778  "/* buffer pour cryptage éventuel du nouveau numéro national */\n" \
779  "char givcNumnat[128];\n" \
780  "char cNumlo[GYBMouvementsLgNumlo + 1];\n" \
781  "char cNumls[GYBMouvementsLgNumls + 1];\n" \
782  "GYBstrBlocBlocidT cBlocidPrec; /* numero de bloc de parution précédent */\n" \
783  "int1 cDrapeauEns; /* Indicateur de presence d'au moins un ensemble */\n" \
784  "int1 cDrapeauEnsDe; /* Indicateur de presence d'au moins un ensemble de */\n" \
785  "char nogrou_sav[7 + 1]; /* num groupement à garder */\n" \
786  "int4 indic_nbclones = 0; /* indicateur nb clones */\n" \
787  "int4 resultat = 0;\n" \
788  "int4 boolen = 0; /* indicateur bloc non vide */\n" \
789  "char nom_bloc[50 + 1]; /* Nom du bloc de parution */\n" \
790  "char nom_bloc_ref[50 + 1]; /* Référecne Nom du bloc de parution */\n" \
791  "int4 num_bloc = 1; /* Numero bloc de parution */\n" \
792  "int4 iMaxBlocEcritAvant;\n" \
793  "int4 iMaxBlocEcritAvantIG;\n" \
794  "static int4 GIVAnnulerBlocCGenTest; /* Annuler le bloc courant à cause d'un echec CGenTest */\n" \
795  "\n" \
796  "EXEC SQL begin declare section;\n" \
797  "\n" \
798  " typedef struct\n" \
799  " {\n" \
800  " char tcPart[5]; /* partenaire */\n" \
801  " char tcProd[3]; /* produit fictif associé */\n" \
802  " } givPartT;\n" \
803  "\n" \
804  " typedef struct\n" \
805  " {\n" \
806  " char designation_ligne[100 + 1]; /* */\n" \
807  " } Tab_designation_ligne;\n" \
808  "\n" \
809  " typedef struct\n" \
810  " {\n" \
811  " char module[300 + 1]; /* */\n" \
812  " } Tab_module;\n" \
813  " \n" \
814  "\n" \
815  "#include \"GYBrDOCUMENTEpj.h\"\n" \
816  "EXEC SQL end declare section;\n" \
817  "\n" \
818  "/*---------------------------------------- Fonctions internes -----------------------------------------------------------*/\n" \
819  "int4 giv_ecrit_partie_3_geo(char** buf_pos_in, GYBrDOCUMENTEpj* docClone, int4 iInit, int4 iRangTri, int4 iTypeLoc, int4 iValLoc, char* pcBalise);\n" \
820  "\n" \
821  "/* Tableau pour la sauvegarde des n documents associés à un groupement */\n" \
822  "GYBrDOCUMENTEpj doc2[GIV_TAILLE_MAX_EPJ];\n" \
823  "/* Tableau pour concaténation des DL des clones */\n" \
824  "char buf_concat[50000];\n" \
825  "/* taille fichier de sortie XML en blocs de parution */\n" \
826  "static int4 giviNbBlocs;\n" \
827  "/* flag fermeture du fichier */\n" \
828  "static int4 giviClose = (int4)GIV::GIXCodeKO;\n" \
829  "\n" \
830  "/* Buffer pour ecriture dans le fichier XML */\n" \
831  "/* La plus grosse ecriture a lieu par la fonction 'givBlocsClones' , attention risque debordement ! */\n" \
832  "char GIVBuffXML[800000];\n" \
833  "/* Buffer intermédiaire pour traduction */\n" \
834  "char GIVBuffInter[800000];\n" \
835  "/* Buffer intermédiaire pour analyse clob */\n" \
836  "char GIVBuffClob[800000];\n" \
837  "/* Buffer complet pour appel API de Cas de Tests */\n" \
838  "char GIVBuffTest[giv_LG_BUFFTEST];\n" \
839  "/* fichier des etablissements perdus */\n" \
840  "FILE* GIVfDescFicETB;\n" \
841  "/* fichier des conflits de contenus */\n" \
842  "FILE* GIVfDescFicCFLT;\n" \
843  "/* fichier des Photos de PVI */\n" \
844  "FILE* GIVfDescFicPhotos;\n" \
845  "\n" \
846  "/* clob pour lecture de données en XMLType */\n" \
847  "static OCIClobLocator* givprClob = NULL;\n" \
848  "static OCIClobLocator* givprDbl1Clob = NULL;\n" \
849  "static OCIClobLocator* givprDbl2Clob = NULL;\n" \
850  "\n" \
851  "static int4 nb_noyau;\n" \
852  "static int4 nb_module;\n" \
853  "static int4 nb_micro;\n" \
854  "static int4 nb_an9;\n" \
855  "static int4 nb_marque;\n" \
856  "/* static int4 nb_designation_ligne = 0; */\n" \
857  "static int4 nb_inscription = 0;\n" \
858  "\n" \
859  "static int4 num_id = 0; /* Numero identifiant parution */\n" \
860  "\n" \
861  "static int4 obtention_iden = 0; /* Flag pour traitement unique */\n" \
862  "char givcCheminBloc[128] = \"\"; /* Pathname des fichiers utilises */\n" \
863  "char givcRepertoire[128] = \"\"; /* Répertoire des fichiers utilises */\n" \
864  "\n" \
865  "static char remplace_espace[5 + 1]; /* Le premier car. va remplacer l'espace selon Reg_Sel_19 */\n" \
866  "\n" \
867  "static char memo_chaine_pjparutionid[100 + 1]; /* Memorisation de la chaine identifiant parution */\n" \
868  "\n" \
869  "static int4 pos_paru_id; /* Position pour écriture parution id */\n" \
870  "char givtcRepSgiPro[128] = \"\"; /* Pathname des fichiers SGIPRO */\n" \
871  "char givtcRepMpg[128] = \"\"; /* Pathname des fichiers du flux MPG */\n" \
872  "char givtcRegCECI[4] = \"\"; /* anciennes/nouvelles régions du CECI */\n" \
873  "char givtcLocArrInst[60] = \"\"; /* Localités à parution sur arrondiseement d'installation */\n" \
874  "char givtcPrioCont[GWT_LG_MAX_LIGNE + 1] = \"\"; /* liste des contenus prioritaires */\n" \
875  "char givtcExceptCont[GWT_LG_MAX_LIGNE + 1] = \"\"; /* liste des exceptions sur les contenus */\n" \
876  "char givtcObjCont[GWT_LG_MAX_LIGNE + 1] = \"\"; /* liste des objets contenu */\n" \
877  "char givtcFourPart[GWT_LG_MAX_LIGNE + 1] = \"\"; /* liste des partenaires à éliminer */\n" \
878  "char givtcContenu[4] = \"\"; /* validation des objets contenu */\n" \
879  "char givtcRapED[5] = \"\"; /* rapprochement ED */\n" \
880  "char givcTriPub[2];\n" \
881  "char givtcAnMes[512] = \"\"; /* liste des objets contenu */\n" \
882  "char givtcSupCplDen[4] = \"\"; /* qualite dans complement de denom */\n" \
883  "char givtcInvDenPn[4] = \"\"; /* inversion ordre denom prenom */\n" \
884  "char givtcGeneIeBlocCRC[4] = \"\"; /* accès à la table GYTtabIeBLocCRC */\n" \
885  "char givtcGeneAffCRC[4] = \"\"; /* affichage de la table GYTtabIeBLocCRC */\n" \
886  "char givtcPartInsc[4] = \"\"; /* affichage partenaire au niveau inscription */\n" \
887  "char givtcClause[GWT_LG_MAX_LIGNE];\n" \
888  "char givtcVersDoc[GWT_LG_MAX_LIGNE]; /* version commune configurée des documents */\n" \
889  "char givtcParuInscEpj[4] = \"\"; /* affichage des parutions par inscription et par epj */\n" \
890  "char givtcContText[4] = \"\"; /* affichage balises contenu et text */\n" \
891  "/* origine de partenaire */\n" \
892  "int4 giviPart;\n" \
893  "static char givtcOriPart[4 + 1] = \"\";\n" \
894  "static char givtcAn9Part[GYBPaprofLgCodan9 + 1] = givcR00000000;\n" \
895  "static char givtcAn8Part[GYBPaprofLgCodan8 + 1] = \"\";\n" \
896  "\n" \
897  "/* Declaration et reservation du document necessaire a la creation d'un bloc XML */\n" \
898  "static GYBrDOCUMENTEpj doc;\n" \
899  "\n" \
900  "/* Correspondance entre les chiffres et les caractères de codage */\n" \
901  "/* du numéro de client dans le champ LO */\n" \
902  "static const nat1 givtcCLIENTLO[] =\n" \
903  "{\n" \
904  " /* 0 1 2 3 4 5 6 7 8 9 A B C D E F*/\n" \
905  " /* 0 */0x41, 0x3B, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0, 0, 0, 0, 0, 0,\n" \
906  " /* 1 */0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0, 0, 0, 0, 0, 0,\n" \
907  " /* 2 */0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0, 0, 0, 0, 0, 0,\n" \
908  " /* 3 */0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0, 0, 0, 0, 0, 0,\n" \
909  " /* 4 */0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0, 0, 0, 0, 0, 0,\n" \
910  " /* 5 */0x79, 0x7A, 0xC4, 0xCB, 0xCF, 0xD6, 0xDC, 0xE4, 0xEB, 0xEF, 0, 0, 0, 0, 0, 0,\n" \
911  " /* 6 */0xF6, 0xFC, 0xFF, 0xC2, 0xCA, 0xCE, 0xD4, 0xDB, 0xE2, 0xEA, 0, 0, 0, 0, 0, 0,\n" \
912  " /* 7 */0xEE, 0xF4, 0xFB, 0xE0, 0xE9, 0xE8, 0xF9, 0xE7, 0xB5, 0x7E, 0, 0, 0, 0, 0, 0,\n" \
913  " /* 8 */0x5E, 0xA8, 0xB0, 0xB2, 0x2B, 0x2D, 0x23, 0x3D, 0x2C, 0x2F, 0, 0, 0, 0, 0, 0,\n" \
914  " /* 9 */0x40, 0x7B, 0x7D, 0x28, 0x29, 0xA7, 0xA3, 0x3F, 0x21, 0x3A, 0, 0, 0, 0, 0, 0,\n" \
915  " /* A */0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" \
916  " /* B */0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" \
917  " /* C */0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" \
918  " /* D */0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" \
919  " /* E */0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" \
920  " /* F */0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" \
921  "};\n" \
922  "/* ASCII numérique */\n" \
923  "#define giv_Min 0x30\n" \
924  "#define giv_Max 0x39\n" \
925  "\n" \
926  "int1 cTabRefClone[] =\n" \
927  "{ 1, 3, 2, 5, 4 };\n" \
928  "\n" \
929  "#define giv_open \"open\"\n" \
930  "#define giv_write \"write\"\n" \
931  "#define giv_close \"close\"\n" \
932  "\n" \
933  "#define givNbCVI 9\n" \
934  "#define givNbFixeCVI 4\n" \
935  "static char* givTabCVI[givNbCVI] =\n" \
936  "{ \" T\", \"NT\", \"NV\", \"NS\", \" P\", \"KT\", \"KV\", \"KS\", \"NM\" };\n" \
937  "#define givNbPart 8\n" \
938  "static givPartT givTabPart[givNbPart] =\n" \
939  "{\n" \
940  " { \"RESA\", \"0C\" },\n" \
941  " { \"EXPD\", \"0E\" },\n" \
942  " { \"LAFO\", \"0L\" },\n" \
943  " { \"ACCO\", \"0A\" },\n" \
944  " { \"CRDV\", \"0R\" },\n" \
945  " { \"LEAD\", \"0F\" },\n" \
946  " { \"CHRO\", \"0O\" },\n" \
947  " { \"PJDC\", \"0D\" }\n" \
948  "};\n" \
949  "\n" \
950  "/* commentaire XML */\n" \
951  "char cComm_xml0[] = \"<!-- \";\n" \
952  "char cComm_xml1[] = \" -->\";\n" \
953  "\n" \
954  "/*-----------------------------Fonctions internes-----------------------------*/\n" \
955  "\n" \
956  "/* HAL, 13/11/2008 pour Linux : ajout des déclarations des fonctions qui sont utilisées avant leur déclaration */\n" \
957  "static int4 giv_sortie(char**, FILE*);\n" \
958  "static int4 giv_sortie_ISO(char**, FILE*);\n" \
959  "static int4 giv_fichier_sortie(char**, FILE**);\n" \
960  "static int4 giv_fermeture_fichier_sortie(char**, char*);\n" \
961  "static int4 giv_ecrit_noeud_simple(char*, char*);\n" \
962  "static int4 giv_ecrit_noeud_attr(char*, char*, char*);\n" \
963  "static int4 giv_ecrit_fin_noeud(char**, char*);\n" \
964  "static int4 givAnalyseContenu(char**, GYBrDOCUMENTEpj*, int4);\n" \
965  "static int4 givEcritContenu(char*, char**, GYBrDOCUMENTEpj*, int4, int4*);\n" \
966  "static int4 givEcritContenuED(char**, GYBrDOCUMENTEpj*, int4);\n" \
967  "static int4 givEcritContenuEDEtab(char*, char**, GYBrDOCUMENTEpj*, int4);\n" \
968  "static int4 givEcritDonAdd(char*, char**, GYBrDOCUMENTEpj*, int4);\n" \
969  "static int4 givEcritDonRelais(char**, GYBrDOCUMENTEpj*, int4, int4);\n" \
970  "static int4 givEcritDonEnr(char**, GYBrDOCUMENTEpj*, int4);\n" \
971  "static int4 givEcritSgiPro(char**, GYBrDOCUMENTEpj*, int4, int4, int4, char*, int4);\n" \
972  "static int4 givEcritSgiProED(char*, char*, char**, char*, GYBrDOCUMENTEpj*, char*, char*, char*, int4*);\n" \
973  "static int4 givEcritSgiProPart(char**, GYBrDOCUMENTEpj*, char*, char*, char*, char*, int4*);\n" \
974  "static int4 givEcritSgiProPartEtab(char**, GYBrDOCUMENTEpj*, int4, char*, char*, char*, char*, int4*);\n" \
975  "static int4 givEcritSgiProBOC(char**, GYBrDOCUMENTEpj*, int4, char*, char*, char*);\n" \
976  "static int4 givEcritImages(char**, GYBrDOCUMENTEpj*, int4);\n" \
977  "static int4 givEcritDonAnnonceur(char**, GYBrDOCUMENTEpj*, int4, int4, int4, char*, int4);\n" \
978  "static int4 givEcritDonEtab(char*, char*, char**, char*, GYBrDOCUMENTEpj*, char*, char*, char*, int4*);\n" \
979  "static int4 givAffCRCEtab(char**);\n" \
980  "static int4 givDelIeBlocCRC(char*);\n" \
981  "static int4 givInsIeBlocCRC(void);\n" \
982  "static int4 givMutualiserDonPartenaires(char**, GYBrDOCUMENTEpj*, int4);\n" \
983  "static int4 givEcritPart(char**, GYBrDOCUMENTEpj*, int4);\n" \
984  "static int4 giv_ecrit_balise(char*, char*, char*);\n" \
985  "static int4 giv_ecrit_balise_epj(char**, char*, char*);\n" \
986  "static int4 giv_ecrit_balise_iso(char*, char*, char*);\n" \
987  "static int4 giv_ecrit_objet_pub(char**, GYBrDOCUMENTEpj*, int4, int4, char*);\n" \
988  "static int4 giv_ecrit_element(char*, char*, char*);\n" \
989  "static int4 givAnalyseCRC(char*, int4, GYBrDOCUMENTEpj*, char*, char*, char*);\n" \
990  "static int4 givAnalyseObjetXML(char*, GYBrDOCUMENTEpj*, char*, char**);\n" \
991  "static int4 givEcritDonHoraires(char**, GYBrDOCUMENTEpj*, int4);\n" \
992  "\n" \
993  "/*----Fonction----------------------------------------------------------------*/\n" \
994  "/* */\n" \
995  "/* Fonction : givTradChar */\n" \
996  "/* */\n" \
997  "/* But : remplacer un caractère dans le buffer de sortie */\n" \
998  "/* */\n" \
999  "/* Entree(s) : le buffer */\n" \
1000  "/* */\n" \
1001  "/* Sortie(s) : le même buffer */\n" \
1002  "/* */\n" \
1003  "/*----------------------------------------------------------------------------*/\n" \
1004  "\n" \
1005  "void givTradChar(int4* lg)\n" \
1006  "{\n" \
1007  " char* pt_fin_liste;\n" \
1008  " char* pt_debut_element;\n" \
1009  " char* pt_fin_element;\n" \
1010  " char* pt_ecriture;\n" \
1011  " int4 lg_element;\n" \
1012  " size_t lgInter, lg_in;\n" \
1013  " iconv_t iConv;\n" \
1014  " char* buf_in;\n" \
1015  " char* buf_out;\n" \
1016  " /* Effacement du buffer */\n" \
1017  " /* Buffer intermédiaire */\n" \
1018  " memcpy(GIVBuffInter, GIVBuffXML, strlen(GIVBuffXML));\n" \
1019  " GIVBuffInter[strlen(GIVBuffXML)] = '\\0';\n" \
1020  " GWTTrace(GWT_NIV_FONCT, (\"Lgs: %d,%d,%d\\n\", *lg, strlen(GIVBuffXML), strlen(GIVBuffInter)));\n" \
1021  " /* Effacement du buffer */\n" \
1022  " GIVBuffXML[0] = '\\0';\n" \
1023  " pt_fin_liste = GIVBuffInter + *lg;\n" \
1024  " pt_ecriture = GIVBuffXML;\n" \
1025  "\n" \
1026  " for (pt_debut_element = GIVBuffInter; pt_debut_element < pt_fin_liste;)\n" \
1027  " {\n" \
1028  " pt_fin_element = strchr(pt_debut_element, '&');\n" \
1029  "\n" \
1030  " if (pt_fin_element == 0)\n" \
1031  " pt_fin_element = pt_fin_liste;\n" \
1032  "\n" \
1033  " lg_element = pt_fin_element - pt_debut_element;\n" \
1034  "\n" \
1035  " /* traduction */\n" \
1036  " if ((GIVBuffInter != pt_debut_element) || (GIVBuffInter == pt_fin_element))\n" \
1037  " {\n" \
1038  " GWTTrace(GWT_NIV_FONCT, (\"Traduction & \\n\"));\n" \
1039  " GWTTrace(GWT_NIV_FONCT, (\"Lg Traduction totale &: %d\\n\", *lg));\n" \
1040  " GWTTrace(GWT_NIV_FONCT, (\"Lg Traduction &: %d\\n\", lg_element));\n" \
1041  " strcpy(pt_ecriture, givTrad);\n" \
1042  " pt_ecriture += strlen(givTrad);\n" \
1043  " }\n" \
1044  "\n" \
1045  " /* copie chaîne non modifiée */\n" \
1046  " memcpy(pt_ecriture, pt_debut_element, lg_element);\n" \
1047  " pt_ecriture = pt_ecriture + lg_element;\n" \
1048  " *pt_ecriture = '\\0';\n" \
1049  " pt_debut_element = pt_fin_element + 1;\n" \
1050  " }\n" \
1051  "\n" \
1052  " *lg = strlen(GIVBuffXML);\n" \
1053  " /* Traduction UTF8 */\n" \
1054  " iConv = iconv_open(\"UTF-8\", \"ISO8859-1\");\n" \
1055  " buf_in = GIVBuffXML;\n" \
1056  " lg_in = strlen(GIVBuffXML) + 1;\n" \
1057  " buf_out = GIVBuffInter;\n" \
1058  " lgInter = sizeof(GIVBuffInter);\n" \
1059  "\n" \
1060  " if ((iconv_t)(-1) != iConv)\n" \
1061  " {\n" \
1062  " iconv(iConv, &buf_in, (size_t*)&lg_in, &buf_out, (size_t*)&lgInter);\n" \
1063  " iconv_close(iConv);\n" \
1064  " strcpy(GIVBuffXML, GIVBuffInter);\n" \
1065  " GWTTrace(GWT_NIV_FONCT, (\"Fin de Conversion UTF8: %d, %d\\n\", lgInter, strlen(GIVBuffXML)));\n" \
1066  " }\n" \
1067  "\n" \
1068  " *lg = strlen(GIVBuffXML);\n" \
1069  " return;\n" \
1070  "}\n" \
1071  "\n" \
1072  "/*----Fonction----------------------------------------------------------------*/\n" \
1073  "/* */\n" \
1074  "/* Fonction : givConvClob */\n" \
1075  "/* */\n" \
1076  "/* But : traitement UTF8, carcatères spéciaux d'un XMLType */\n" \
1077  "/* */\n" \
1078  "/* Entree(s) : le buffer */\n" \
1079  "/* */\n" \
1080  "/* Sortie(s) : le même buffer */\n" \
1081  "/* */\n" \
1082  "/*----------------------------------------------------------------------------*/\n" \
1083  "\n" \
1084  "void givConvClob()\n" \
1085  "{\n" \
1086  " size_t lgInter, lg_in;\n" \
1087  " iconv_t iConv;\n" \
1088  " char* buf_in;\n" \
1089  " char* buf_out;\n" \
1090  " (void)strcpy(GIVBuffXML, GIVBuffInter);\n" \
1091  " /* Traduction UTF8 */\n" \
1092  " iConv = iconv_open(\"UTF-8\", \"ISO8859-1\");\n" \
1093  " buf_in = GIVBuffXML;\n" \
1094  " lg_in = strlen(GIVBuffXML) + 1;\n" \
1095  " buf_out = GIVBuffInter;\n" \
1096  " lgInter = sizeof(GIVBuffInter);\n" \
1097  "\n" \
1098  " if ((iconv_t)(-1) != iConv)\n" \
1099  " {\n" \
1100  " iconv(iConv, &buf_in, (size_t*)&lg_in, &buf_out, (size_t*)&lgInter);\n" \
1101  " iconv_close(iConv);\n" \
1102  " /* Mantis 70297 : remplacement des caractères spéciaux par leur chaîne UTF8 */\n" \
1103  " /* (les caractères Laquo et Raquo sont éliminés en amont par PJ) */\n" \
1104  " gwtRemplaceChaine(GIVBuffInter, GXW_cg_Euro, GXW_utf8_Euro, GIVBuffXML);\n" \
1105  " gwtRemplaceChaine(GIVBuffXML, GXW_cg_OE, GXW_utf8_OE, GIVBuffInter);\n" \
1106  " gwtRemplaceChaine(GIVBuffInter, GXW_cg_oe, GXW_utf8_oe, GIVBuffXML);\n" \
1107  " gwtRemplaceChaine(GIVBuffXML, GXW_cg_Copyright, GXW_utf8_Copyright, GIVBuffInter);\n" \
1108  " gwtRemplaceChaine(GIVBuffInter, GXW_cg_Nbsp, GXW_utf8_Nbsp, GIVBuffXML);\n" \
1109  " gwtRemplaceChaine(GIVBuffXML, GXW_cg_Laquo, GXW_utf8_Laquo, GIVBuffInter);\n" \
1110  " gwtRemplaceChaine(GIVBuffInter, GXW_cg_Raquo, GXW_utf8_Raquo, GIVBuffXML);\n" \
1111  " (void)strcpy(GIVBuffInter, GIVBuffXML);\n" \
1112  " GWTTrace(GWT_NIV_FONCT, (\"Fin de Conversion UTF8: %d, %d\\n\", lgInter, strlen(GIVBuffInter)));\n" \
1113  " }\n" \
1114  "\n" \
1115  " GIVBuffXML[0] = '\\0';\n" \
1116  " return;\n" \
1117  "}\n" \
1118  "\n" \
1119  "/*----Fonction----------------------------------------------------------------*/\n" \
1120  "/* */\n" \
1121  "/* Fonction : givConvURL */\n" \
1122  "/* */\n" \
1123  "/* But : traitement UTF8, carcatères spéciaux d'une URL */\n" \
1124  "/* */\n" \
1125  "/* Entree(s) : le buffer */\n" \
1126  "/* */\n" \
1127  "/* Sortie(s) : le même buffer */\n" \
1128  "/* */\n" \
1129  "/*----------------------------------------------------------------------------*/\n" \
1130  "\n" \
1131  "void givConvURL(char* acLibUrl)\n" \
1132  "{\n" \
1133  " size_t lgInter, lg_in;\n" \
1134  " iconv_t iConv;\n" \
1135  " char* buf_in;\n" \
1136  " char* buf_out;\n" \
1137  " int4 i, j;\n" \
1138  " buf_concat[0] = '\\0';\n" \
1139  " /* traduction de <,> et \" */\n" \
1140  " j = 0;\n" \
1141  "\n" \
1142  " for (i = 0; i < strlen(acLibUrl); i++)\n" \
1143  " {\n" \
1144  " if ('<' == acLibUrl[i])\n" \
1145  " {\n" \
1146  " buf_concat[j] = '\\0';\n" \
1147  " strcat(buf_concat, \"&lt;\");\n" \
1148  " j = strlen(buf_concat);\n" \
1149  " }\n" \
1150  " else if ('>' == acLibUrl[i])\n" \
1151  " {\n" \
1152  " buf_concat[j] = '\\0';\n" \
1153  " strcat(buf_concat, \"&gt;\");\n" \
1154  " j = strlen(buf_concat);\n" \
1155  " }\n" \
1156  " else if ('\"' == acLibUrl[i])\n" \
1157  " {\n" \
1158  " buf_concat[j] = '\\0';\n" \
1159  " strcat(buf_concat, \"&quot;\");\n" \
1160  " j = strlen(buf_concat);\n" \
1161  " }\n" \
1162  " else if ('&' == acLibUrl[i])\n" \
1163  " {\n" \
1164  " buf_concat[j] = '\\0';\n" \
1165  " strcat(buf_concat, givTrad);\n" \
1166  " j = strlen(buf_concat);\n" \
1167  " }\n" \
1168  " else\n" \
1169  " {\n" \
1170  " buf_concat[j] = acLibUrl[i];\n" \
1171  " j++;\n" \
1172  " }\n" \
1173  " }\n" \
1174  "\n" \
1175  " buf_concat[j] = '\\0';\n" \
1176  " /* Traduction UTF8 */\n" \
1177  " iConv = iconv_open(\"UTF-8\", \"ISO8859-1\");\n" \
1178  " buf_in = buf_concat;\n" \
1179  " lg_in = strlen(buf_concat) + 1;\n" \
1180  " buf_out = GIVBuffInter;\n" \
1181  " lgInter = sizeof(GIVBuffInter);\n" \
1182  "\n" \
1183  " if ((iconv_t)(-1) != iConv)\n" \
1184  " {\n" \
1185  " iconv(iConv, &buf_in, (size_t*)&lg_in, &buf_out, (size_t*)&lgInter);\n" \
1186  " iconv_close(iConv);\n" \
1187  " strcpy(buf_concat, GIVBuffInter);\n" \
1188  " GWTTrace(GWT_NIV_FONCT, (\"Fin de Conversion UTF8: %d, %d\\n\", lgInter, strlen(buf_concat)));\n" \
1189  " }\n" \
1190  "\n" \
1191  " return;\n" \
1192  "}\n" \
1193  "\n" \
1194  "/*----Fonction----------------------------------------------------------------*/\n" \
1195  "/* */\n" \
1196  "/* Fonction : givLectClob */\n" \
1197  "/* */\n" \
1198  "/* But : lecture d'un clob en varchar */\n" \
1199  "/* */\n" \
1200  "/* Entree(s) : clob */\n" \
1201  "/* */\n" \
1202  "/* Sortie(s) : buffer */\n" \
1203  "/* */\n" \
1204  "/*----------------------------------------------------------------------------*/\n" \
1205  "\n" \
1206  "void givLectClob(OCIClobLocator* apClob, char* apcEtab, char* apcObj, char* apcTyp, char* apcSource)\n" \
1207  "{\n" \
1208  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
1209  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour des appels internes */\n" \
1210  " EXEC SQL\n" \
1211  " begin declare\n" \
1212  " section;\n" \
1213  " OCIClobLocator* pOraClob;\n" \
1214  " int4 iLgEcrit = 0;\n" \
1215  " nat8 length;\n" \
1216  " nat8 lgthmax;\n" \
1217  " VARCHAR tcXMLTexte[giv_LG_CLOB + 1];\n" \
1218  " EXEC SQL\n" \
1219  " end declare\n" \
1220  " section;\n" \
1221  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
1222  " /* lecture du début de bloc */\n" \
1223  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Lecture dans CLOB\");\n" \
1224  " iIntRet = (int4)GIV::GYBok;\n" \
1225  " length = 0;\n" \
1226  " lgthmax = giv_LG_CLOB;\n" \
1227  " iLgEcrit = 0;\n" \
1228  " pOraClob = apClob;\n" \
1229  " GIVBuffInter[0] = '\\0';\n" \
1230  "\n" \
1231  " while (((int4)GIV::GYBok == iIntRet) && (NULL != pOraClob))\n" \
1232  " {\n" \
1233  " tcXMLTexte.arr[0] = '\\0';\n" \
1234  " tcXMLTexte.len = giv_LG_CLOB;\n" \
1235  " EXEC SQL\n" \
1236  " LOB\n" \
1237  " READ :length\n" \
1238  " FROM :pOraClob\n" \
1239  " INTO :tcXMLTexte WITH\n" \
1240  " LENGTH: lgthmax;\n" \
1241  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
1242  " GWTTrace(GWT_NIV_FONCT, (\"Taille lob lue: %d,%d,%d\\n\", iIntRet, length, tcXMLTexte.len));\n" \
1243  "\n" \
1244  " /* Analyse du code resultat SQL */\n" \
1245  " if (((int4)GIV::GYBok != iIntRet) && ((int4)GIV::GYBnodata != iIntRet))\n" \
1246  " {\n" \
1247  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acOrdre_sql));\n" \
1248  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur lecture Clob: Epj='%s' Obj='%s' Typ='%s' Src='%s'\\n\", apcEtab, apcObj, apcTyp, apcSource));\n" \
1249  " iIntRet = (int4)GIV::GYBnok;\n" \
1250  " }\n" \
1251  " else\n" \
1252  " {\n" \
1253  " tcXMLTexte.arr[tcXMLTexte.len] = '\\0';\n" \
1254  " GWTTrace(GWT_NIV_FONCT, (\"Debut lob lu: !%c,%c,%c!\\n\", tcXMLTexte.arr[0], tcXMLTexte.arr[1], tcXMLTexte.arr[2]));\n" \
1255  " GWTTrace(GWT_NIV_FONCT, (\"Fin lob lu: !%s!\\n\", &tcXMLTexte.arr[tcXMLTexte.len - 5]));\n" \
1256  "\n" \
1257  " /* suppression de l'indentation */\n" \
1258  " if ((int4)sizeof(GIVBuffInter) <= (iLgEcrit + (int4)tcXMLTexte.len))\n" \
1259  " {\n" \
1260  " /* fin car buffer insuffisant */\n" \
1261  " GWTTrace(GWT_NIV_GRAVE, (\"Buffer lecture Clob insuffisant : Epj='%s' Obj='%s' Typ='%s' Src='%s'\\n\", apcEtab, apcObj, apcTyp, apcSource));\n" \
1262  " GWTTrace(GWT_NIV_GRAVE, (\"Taille Clob lue: %d,%d,%d,%d\\n\", iIntRet, length, tcXMLTexte.len, iLgEcrit));\n" \
1263  " iIntRet = (int4)GIV::GYBnok;\n" \
1264  " }\n" \
1265  " else\n" \
1266  " {\n" \
1267  " (void)GIWSuppIndent((char*)tcXMLTexte.arr, &GIVBuffInter[iLgEcrit]);\n" \
1268  " iLgEcrit = strlen(GIVBuffInter);\n" \
1269  " }\n" \
1270  "\n" \
1271  " if ((int4)GIV::GYBnodata == iIntRet)\n" \
1272  " {\n" \
1273  " /* fin de lecture */\n" \
1274  " iIntRet = (int4)GIV::GYBnok;\n" \
1275  " }\n" \
1276  " }\n" \
1277  " }\n" \
1278  "\n" \
1279  " return;\n" \
1280  "}\n" \
1281  "\n" \
1282  "/*----Fonction----------------------------------------------------------------*/\n" \
1283  "/* */\n" \
1284  "/* Fonction : GIVCodeClient */\n" \
1285  "/*----------------------------------------------------------------------------*/\n" \
1286  "int4 GIVCodeClient(char* cClient, int4 lg_chp)\n" \
1287  "{\n" \
1288  " int4 iLong = 0;\n" \
1289  " int4 iVal, i = 0;\n" \
1290  " int4 iCodRet = (int4)GIV::GWCCodeOK;\n" \
1291  " char client_decode[14 + 1] = \"\"; /* numlo ou IG decode pr bloc de parution */\n" \
1292  "\n" \
1293  " for (i = 0; i < lg_chp; i++)\n" \
1294  " {\n" \
1295  " if ((cClient[i] >= giv_Min) && (cClient[i] <= giv_Max))\n" \
1296  " {\n" \
1297  " strcpy(client_decode, cClient);\n" \
1298  " break;\n" \
1299  " }\n" \
1300  " }\n" \
1301  "\n" \
1302  " if (lg_chp == i)\n" \
1303  " {\n" \
1304  " while (iLong < lg_chp)\n" \
1305  " {\n" \
1306  " iVal = 0;\n" \
1307  "\n" \
1308  " while (((nat1)(cClient[iLong]) != givtcCLIENTLO[iVal]) && (256 != iVal))\n" \
1309  " iVal++;\n" \
1310  "\n" \
1311  " if (iVal == 256)\n" \
1312  " {\n" \
1313  " GWTTrace(GWT_NIV_FONCT, (\"Erreur ne retrouve pas la valeur ...\\n\"));\n" \
1314  " iCodRet = (int4)GIV::GWCCodeKO;\n" \
1315  " }\n" \
1316  "\n" \
1317  " client_decode[(iLong * 2) + 1] = (char)((iVal % giv_DIV_PAR_DIX) + '0');\n" \
1318  " iVal = iVal / giv_DIV_PAR_DIX;\n" \
1319  " client_decode[(iLong * 2)] = (char)((iVal % giv_DIV_PAR_DIX) + '0');\n" \
1320  " iLong++;\n" \
1321  " }\n" \
1322  " }\n" \
1323  "\n" \
1324  " GWTTrace(GWT_NIV_FONCT, (\"client_decode = %s\\n\", client_decode));\n" \
1325  " strcpy(GIVtcClientDecode, client_decode);\n" \
1326  " return (iCodRet);\n" \
1327  "}\n" \
1328  "/*---------------------fin fonction-------------------------------------------*/\n" \
1329  "\n" \
1330  "/*----Fonction----------------------------------------------------------------*/\n" \
1331  "/* */\n" \
1332  "/* Fonction : givPreparerLectureEtab () */\n" \
1333  "/* */\n" \
1334  "/* But : Preparation de la requete SQL de recherche des données */\n" \
1335  "/* à partir de l'établissement dans les tables GYTtabPeetab, */\n" \
1336  "/* GYTtabEpjMic et GYTTabLiensEtab */\n" \
1337  "/* */\n" \
1338  "/* Entree(s) : */\n" \
1339  "/* */\n" \
1340  "/* Sortie(s) : OK ou KO */\n" \
1341  "/* */\n" \
1342  "/* Portable : Transparent */\n" \
1343  "/* */\n" \
1344  "/*----------------------------------------------------------------------------*/\n" \
1345  "\n" \
1346  "extern int4 givPreparerLectureEtab(void)\n" \
1347  "\n" \
1348  "{\n" \
1349  " int4 iCodRet; /* Code retour de la fonction */\n" \
1350  " int4 iIntRet; /* Code retour interne */\n" \
1351  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
1352  " int4 iLgBuffer;\n" \
1353  " int4 iLgRequete;\n" \
1354  " EXEC SQL\n" \
1355  " begin declare\n" \
1356  " section;\n" \
1357  " char cRequete[giv_LG_REQUETE * 4];\n" \
1358  " EXEC SQL\n" \
1359  " end declare\n" \
1360  " section;\n" \
1361  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureEtabMC\\n\"));\n" \
1362  " /* Initialisation des variables locales */\n" \
1363  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
1364  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
1365  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
1366  " /* Controle de la longueur du texte de la requete */\n" \
1367  " iLgRequete = strlen(GIV_RQ_SELECT_ETAB_MC);\n" \
1368  " iLgBuffer = sizeof(cRequete);\n" \
1369  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1370  "\n" \
1371  " if (iLgBuffer <= iLgRequete)\n" \
1372  " {\n" \
1373  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1374  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1375  " }\n" \
1376  "\n" \
1377  " /* Construction du texte de la requete */\n" \
1378  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1379  " {\n" \
1380  " (void)sprintf(cRequete,\n" \
1381  " GIV_RQ_SELECT_ETAB_MC);\n" \
1382  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1383  " /* Controle et parsing de la requete SQL */\n" \
1384  " EXEC SQL\n" \
1385  " prepare rqtLectureEtabMC\n" \
1386  " from: cRequete;\n" \
1387  " /* Traitement des erreurs SQL */\n" \
1388  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureEtabMC\");\n" \
1389  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1390  "\n" \
1391  " if ((int4)GIV::GYBok != iIntRet)\n" \
1392  " {\n" \
1393  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureEtabMC : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1394  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1395  " }\n" \
1396  " else\n" \
1397  " {\n" \
1398  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1399  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureEtabMC\");\n" \
1400  " EXEC SQL\n" \
1401  " declare crsLectureEtabMC\n" \
1402  " cursor\n" \
1403  " for rqtLectureEtabMC;\n" \
1404  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1405  "\n" \
1406  " if ((int4)GIV::GYBok != iIntRet)\n" \
1407  " {\n" \
1408  " /* Erreur sur declaration curseur SQL */\n" \
1409  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureEtabMC ...\\n\"));\n" \
1410  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1411  " }\n" \
1412  " }\n" \
1413  " }\n" \
1414  "\n" \
1415  " /* Controle de la longueur du texte de la requete */\n" \
1416  " iLgRequete = strlen(GIV_RQ_SELECT_SIREN);\n" \
1417  " iLgBuffer = sizeof(cRequete);\n" \
1418  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1419  "\n" \
1420  " if (iLgBuffer <= iLgRequete)\n" \
1421  " {\n" \
1422  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1423  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1424  " }\n" \
1425  "\n" \
1426  " /* Construction du texte de la requete */\n" \
1427  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1428  " {\n" \
1429  " (void)sprintf(cRequete,\n" \
1430  " GIV_RQ_SELECT_SIREN);\n" \
1431  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1432  " /* Controle et parsing de la requete SQL */\n" \
1433  " EXEC SQL\n" \
1434  " prepare rqtLectureSiren\n" \
1435  " from: cRequete;\n" \
1436  " /* Traitement des erreurs SQL */\n" \
1437  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureSiren\");\n" \
1438  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1439  "\n" \
1440  " if ((int4)GIV::GYBok != iIntRet)\n" \
1441  " {\n" \
1442  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureSirenC : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1443  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1444  " }\n" \
1445  " else\n" \
1446  " {\n" \
1447  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1448  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureSiren\");\n" \
1449  " EXEC SQL\n" \
1450  " declare crsLectureSiren\n" \
1451  " cursor\n" \
1452  " for rqtLectureSiren;\n" \
1453  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1454  "\n" \
1455  " if ((int4)GIV::GYBok != iIntRet)\n" \
1456  " {\n" \
1457  " /* Erreur sur declaration curseur SQL */\n" \
1458  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureSiren ...\\n\"));\n" \
1459  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1460  " }\n" \
1461  " }\n" \
1462  " }\n" \
1463  "\n" \
1464  " /* Controle de la longueur du texte de la requete */\n" \
1465  " iLgRequete = strlen(GIV_RQ_SELECT_ETAB);\n" \
1466  " iLgBuffer = sizeof(cRequete);\n" \
1467  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1468  "\n" \
1469  " if (iLgBuffer <= iLgRequete)\n" \
1470  " {\n" \
1471  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1472  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1473  " }\n" \
1474  "\n" \
1475  " /* Construction du texte de la requete */\n" \
1476  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1477  " {\n" \
1478  " (void)sprintf(cRequete,\n" \
1479  " GIV_RQ_SELECT_ETAB);\n" \
1480  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1481  " /* Controle et parsing de la requete SQL */\n" \
1482  " EXEC SQL\n" \
1483  " prepare rqtLectureEtab\n" \
1484  " from: cRequete;\n" \
1485  " /* Traitement des erreurs SQL */\n" \
1486  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureEtab\");\n" \
1487  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1488  "\n" \
1489  " if ((int4)GIV::GYBok != iIntRet)\n" \
1490  " {\n" \
1491  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureEtab : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1492  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1493  " }\n" \
1494  " else\n" \
1495  " {\n" \
1496  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1497  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureEtab\");\n" \
1498  " EXEC SQL\n" \
1499  " declare crsLectureEtab\n" \
1500  " cursor\n" \
1501  " for rqtLectureEtab;\n" \
1502  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1503  "\n" \
1504  " if ((int4)GIV::GYBok != iIntRet)\n" \
1505  " {\n" \
1506  " /* Erreur sur declaration curseur SQL */\n" \
1507  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureEtab ...\\n\"));\n" \
1508  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1509  " }\n" \
1510  " }\n" \
1511  " }\n" \
1512  "\n" \
1513  " /* Controle de la longueur du texte de la requete */\n" \
1514  " iLgRequete = strlen(GIV_RQ_SELECT_DENOM_ETAB);\n" \
1515  " iLgBuffer = sizeof(cRequete);\n" \
1516  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1517  "\n" \
1518  " if (iLgBuffer <= iLgRequete)\n" \
1519  " {\n" \
1520  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1521  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1522  " }\n" \
1523  "\n" \
1524  " /* Construction du texte de la requete */\n" \
1525  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1526  " {\n" \
1527  " (void)sprintf(cRequete,\n" \
1528  " GIV_RQ_SELECT_DENOM_ETAB);\n" \
1529  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1530  " /* Controle et parsing de la requete SQL */\n" \
1531  " EXEC SQL\n" \
1532  " prepare rqtLectureDenomEtab\n" \
1533  " from: cRequete;\n" \
1534  " /* Traitement des erreurs SQL */\n" \
1535  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureDenomEtab\");\n" \
1536  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1537  "\n" \
1538  " if ((int4)GIV::GYBok != iIntRet)\n" \
1539  " {\n" \
1540  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureDenomEtab : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1541  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1542  " }\n" \
1543  " else\n" \
1544  " {\n" \
1545  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1546  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureDenomEtab\");\n" \
1547  " EXEC SQL\n" \
1548  " declare crsLectureDenomEtab\n" \
1549  " cursor\n" \
1550  " for rqtLectureDenomEtab;\n" \
1551  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1552  "\n" \
1553  " if ((int4)GIV::GYBok != iIntRet)\n" \
1554  " {\n" \
1555  " /* Erreur sur declaration curseur SQL */\n" \
1556  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureDenomEtab ...\\n\"));\n" \
1557  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1558  " }\n" \
1559  " }\n" \
1560  " }\n" \
1561  "\n" \
1562  " /* Controle de la longueur du texte de la requete */\n" \
1563  " iLgRequete = strlen(GIV_RQ_SELECT_PHOTOS_ETAB);\n" \
1564  " iLgBuffer = sizeof(cRequete);\n" \
1565  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1566  "\n" \
1567  " if (iLgBuffer <= iLgRequete)\n" \
1568  " {\n" \
1569  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1570  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1571  " }\n" \
1572  "\n" \
1573  " /* Construction du texte de la requete */\n" \
1574  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1575  " {\n" \
1576  " (void)sprintf(cRequete,\n" \
1577  " GIV_RQ_SELECT_PHOTOS_ETAB);\n" \
1578  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1579  " /* Controle et parsing de la requete SQL */\n" \
1580  " EXEC SQL\n" \
1581  " prepare rqtLecturePhotosEtab\n" \
1582  " from: cRequete;\n" \
1583  " /* Traitement des erreurs SQL */\n" \
1584  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLecturePhotosEtab\");\n" \
1585  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1586  "\n" \
1587  " if ((int4)GIV::GYBok != iIntRet)\n" \
1588  " {\n" \
1589  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLecturePhotosEtab : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1590  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1591  " }\n" \
1592  " else\n" \
1593  " {\n" \
1594  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1595  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLecturePhotosEtab\");\n" \
1596  " EXEC SQL\n" \
1597  " declare crsLecturePhotosEtab\n" \
1598  " cursor\n" \
1599  " for rqtLecturePhotosEtab;\n" \
1600  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1601  "\n" \
1602  " if ((int4)GIV::GYBok != iIntRet)\n" \
1603  " {\n" \
1604  " /* Erreur sur declaration curseur SQL */\n" \
1605  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLecturePhotosEtab ...\\n\"));\n" \
1606  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1607  " }\n" \
1608  " }\n" \
1609  " }\n" \
1610  "\n" \
1611  " /* Controle de la longueur du texte de la requete */\n" \
1612  " iLgRequete = strlen(GIV_RQ_SELECT_PUB_ETAB);\n" \
1613  " iLgBuffer = sizeof(cRequete);\n" \
1614  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1615  "\n" \
1616  " if (iLgBuffer <= iLgRequete)\n" \
1617  " {\n" \
1618  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1619  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1620  " }\n" \
1621  "\n" \
1622  " /* Construction du texte de la requete */\n" \
1623  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1624  " {\n" \
1625  " (void)sprintf(cRequete,\n" \
1626  " GIV_RQ_SELECT_PUB_ETAB);\n" \
1627  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1628  " /* Controle et parsing de la requete SQL */\n" \
1629  " EXEC SQL\n" \
1630  " prepare rqtLecturePubEtab\n" \
1631  " from: cRequete;\n" \
1632  " /* Traitement des erreurs SQL */\n" \
1633  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLecturePubEtab\");\n" \
1634  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1635  "\n" \
1636  " if ((int4)GIV::GYBok != iIntRet)\n" \
1637  " {\n" \
1638  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLecturePubEtab : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1639  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1640  " }\n" \
1641  " else\n" \
1642  " {\n" \
1643  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1644  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLecturePubEtab\");\n" \
1645  " EXEC SQL\n" \
1646  " declare crsLecturePubEtab\n" \
1647  " cursor\n" \
1648  " for rqtLecturePubEtab;\n" \
1649  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1650  "\n" \
1651  " if ((int4)GIV::GYBok != iIntRet)\n" \
1652  " {\n" \
1653  " /* Erreur sur declaration curseur SQL */\n" \
1654  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLecturePubEtab ...\\n\"));\n" \
1655  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1656  " }\n" \
1657  " }\n" \
1658  " }\n" \
1659  "\n" \
1660  " /* Controle de la longueur du texte de la requete */\n" \
1661  " iLgRequete = strlen(GIV_RQ_SELECT_PUB_GCPT);\n" \
1662  " iLgBuffer = sizeof(cRequete);\n" \
1663  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1664  "\n" \
1665  " if (iLgBuffer <= iLgRequete)\n" \
1666  " {\n" \
1667  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1668  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1669  " }\n" \
1670  "\n" \
1671  " /* Construction du texte de la requete */\n" \
1672  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1673  " {\n" \
1674  " (void)sprintf(cRequete,\n" \
1675  " GIV_RQ_SELECT_PUB_GCPT);\n" \
1676  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1677  " /* Controle et parsing de la requete SQL */\n" \
1678  " EXEC SQL\n" \
1679  " prepare rqtLecturePubGCpt\n" \
1680  " from: cRequete;\n" \
1681  " /* Traitement des erreurs SQL */\n" \
1682  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLecturePubGCpt\");\n" \
1683  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1684  "\n" \
1685  " if ((int4)GIV::GYBok != iIntRet)\n" \
1686  " {\n" \
1687  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLecturePubGCpt : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1688  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1689  " }\n" \
1690  " else\n" \
1691  " {\n" \
1692  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1693  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLecturePubGCpt\");\n" \
1694  " EXEC SQL\n" \
1695  " declare crsLecturePubGCpt\n" \
1696  " cursor\n" \
1697  " for rqtLecturePubGCpt;\n" \
1698  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1699  "\n" \
1700  " if ((int4)GIV::GYBok != iIntRet)\n" \
1701  " {\n" \
1702  " /* Erreur sur declaration curseur SQL */\n" \
1703  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLecturePubGCpt ...\\n\"));\n" \
1704  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1705  " }\n" \
1706  " }\n" \
1707  " }\n" \
1708  "\n" \
1709  " /* Controle de la longueur du texte de la requete */\n" \
1710  " iLgRequete = strlen(GIV_RQ_SELECT_PEETAB);\n" \
1711  " iLgBuffer = sizeof(cRequete);\n" \
1712  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1713  "\n" \
1714  " if (iLgBuffer <= iLgRequete)\n" \
1715  " {\n" \
1716  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1717  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1718  " }\n" \
1719  "\n" \
1720  " /* Construction du texte de la requete */\n" \
1721  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1722  " {\n" \
1723  " (void)sprintf(cRequete,\n" \
1724  " GIV_RQ_SELECT_PEETAB);\n" \
1725  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1726  " /* Controle et parsing de la requete SQL */\n" \
1727  " EXEC SQL\n" \
1728  " prepare rqtLecturePeEtab\n" \
1729  " from: cRequete;\n" \
1730  " /* Traitement des erreurs SQL */\n" \
1731  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLecturePeEtab\");\n" \
1732  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1733  "\n" \
1734  " if ((int4)GIV::GYBok != iIntRet)\n" \
1735  " {\n" \
1736  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLecturePeEtab : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1737  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1738  " }\n" \
1739  " else\n" \
1740  " {\n" \
1741  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1742  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLecturePeEtab\");\n" \
1743  " EXEC SQL\n" \
1744  " declare crsLecturePeEtab\n" \
1745  " cursor\n" \
1746  " for rqtLecturePeEtab;\n" \
1747  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1748  "\n" \
1749  " if ((int4)GIV::GYBok != iIntRet)\n" \
1750  " {\n" \
1751  " /* Erreur sur declaration curseur SQL */\n" \
1752  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLecturePeEtab ...\\n\"));\n" \
1753  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1754  " }\n" \
1755  " }\n" \
1756  " }\n" \
1757  "\n" \
1758  " /* Controle de la longueur du texte de la requete */\n" \
1759  " iLgRequete = strlen(GIV_RQ_SELECT_OLD_ETAB);\n" \
1760  " iLgBuffer = sizeof(cRequete);\n" \
1761  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1762  "\n" \
1763  " if (iLgBuffer <= iLgRequete)\n" \
1764  " {\n" \
1765  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1766  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1767  " }\n" \
1768  "\n" \
1769  " /* Construction du texte de la requete */\n" \
1770  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1771  " {\n" \
1772  " (void)sprintf(cRequete,\n" \
1773  " GIV_RQ_SELECT_OLD_ETAB);\n" \
1774  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1775  " /* Controle et parsing de la requete SQL */\n" \
1776  " EXEC SQL\n" \
1777  " prepare rqtLectureOldEtab\n" \
1778  " from: cRequete;\n" \
1779  " /* Traitement des erreurs SQL */\n" \
1780  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureOldEtab\");\n" \
1781  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1782  "\n" \
1783  " if ((int4)GIV::GYBok != iIntRet)\n" \
1784  " {\n" \
1785  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureOldEtab : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1786  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1787  " }\n" \
1788  " else\n" \
1789  " {\n" \
1790  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1791  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureOldEtab\");\n" \
1792  " EXEC SQL\n" \
1793  " declare crsLectureOldEtab\n" \
1794  " cursor\n" \
1795  " for rqtLectureOldEtab;\n" \
1796  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1797  "\n" \
1798  " if ((int4)GIV::GYBok != iIntRet)\n" \
1799  " {\n" \
1800  " /* Erreur sur declaration curseur SQL */\n" \
1801  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureOldEtab ...\\n\"));\n" \
1802  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1803  " }\n" \
1804  " }\n" \
1805  " }\n" \
1806  "\n" \
1807  " /* Controle de la longueur du texte de la requete */\n" \
1808  " iLgRequete = strlen(GIV_SLC_CONT_PROF_ETAB);\n" \
1809  " iLgBuffer = sizeof(cRequete);\n" \
1810  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1811  "\n" \
1812  " if (iLgBuffer <= iLgRequete)\n" \
1813  " {\n" \
1814  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1815  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1816  " }\n" \
1817  "\n" \
1818  " /* Construction du texte de la requete */\n" \
1819  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1820  " {\n" \
1821  " (void)sprintf(cRequete,\n" \
1822  " GIV_SLC_CONT_PROF_ETAB);\n" \
1823  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1824  " /* Controle et parsing de la requete SQL */\n" \
1825  " EXEC SQL\n" \
1826  " prepare rqtLectureContProfEtab\n" \
1827  " from: cRequete;\n" \
1828  " /* Traitement des erreurs SQL */\n" \
1829  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureContProfEtab\");\n" \
1830  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1831  "\n" \
1832  " if ((int4)GIV::GYBok != iIntRet)\n" \
1833  " {\n" \
1834  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureContProfEtab : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1835  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1836  " }\n" \
1837  " else\n" \
1838  " {\n" \
1839  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1840  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureContProfEtab\");\n" \
1841  " EXEC SQL\n" \
1842  " declare crsLectureContProfEtab\n" \
1843  " cursor\n" \
1844  " for rqtLectureContProfEtab;\n" \
1845  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1846  "\n" \
1847  " if ((int4)GIV::GYBok != iIntRet)\n" \
1848  " {\n" \
1849  " /* Erreur sur declaration curseur SQL */\n" \
1850  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureContProfEtab ...\\n\"));\n" \
1851  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1852  " }\n" \
1853  " }\n" \
1854  " }\n" \
1855  "\n" \
1856  " /* Controle de la longueur du texte de la requete */\n" \
1857  " iLgRequete = strlen(GIV_SLC_TYP_CONT_ETAB);\n" \
1858  " iLgBuffer = sizeof(cRequete);\n" \
1859  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1860  "\n" \
1861  " if (iLgBuffer <= iLgRequete)\n" \
1862  " {\n" \
1863  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1864  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1865  " }\n" \
1866  "\n" \
1867  " /* Construction du texte de la requete */\n" \
1868  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1869  " {\n" \
1870  " (void)sprintf(cRequete,\n" \
1871  " GIV_SLC_TYP_CONT_ETAB);\n" \
1872  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1873  " /* Controle et parsing de la requete SQL */\n" \
1874  " EXEC SQL\n" \
1875  " prepare rqtLectureTypContEtab\n" \
1876  " from: cRequete;\n" \
1877  " /* Traitement des erreurs SQL */\n" \
1878  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureTypCont\");\n" \
1879  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1880  "\n" \
1881  " if ((int4)GIV::GYBok != iIntRet)\n" \
1882  " {\n" \
1883  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureTypContEtab : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1884  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1885  " }\n" \
1886  " else\n" \
1887  " {\n" \
1888  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1889  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureTypContEtab\");\n" \
1890  " EXEC SQL\n" \
1891  " declare crsLectureTypContEtab\n" \
1892  " cursor\n" \
1893  " for rqtLectureTypContEtab;\n" \
1894  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1895  "\n" \
1896  " if ((int4)GIV::GYBok != iIntRet)\n" \
1897  " {\n" \
1898  " /* Erreur sur declaration curseur SQL */\n" \
1899  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureTypContEtab ...\\n\"));\n" \
1900  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1901  " }\n" \
1902  " }\n" \
1903  " }\n" \
1904  "\n" \
1905  " /* Controle de la longueur du texte de la requete */\n" \
1906  " iLgRequete = strlen(GIV_SLC_LVS_SEO_ETAB);\n" \
1907  " iLgBuffer = sizeof(cRequete);\n" \
1908  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1909  "\n" \
1910  " if (iLgBuffer <= iLgRequete)\n" \
1911  " {\n" \
1912  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1913  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1914  " }\n" \
1915  "\n" \
1916  " /* Construction du texte de la requete */\n" \
1917  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1918  " {\n" \
1919  " (void)sprintf(cRequete,\n" \
1920  " GIV_SLC_LVS_SEO_ETAB);\n" \
1921  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1922  " /* Controle et parsing de la requete SQL */\n" \
1923  " EXEC SQL\n" \
1924  " prepare rqtLectureLvsSeoEtab\n" \
1925  " from: cRequete;\n" \
1926  " /* Traitement des erreurs SQL */\n" \
1927  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureLvsSeo\");\n" \
1928  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1929  "\n" \
1930  " if ((int4)GIV::GYBok != iIntRet)\n" \
1931  " {\n" \
1932  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureLvsSeoEtab : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1933  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1934  " }\n" \
1935  " else\n" \
1936  " {\n" \
1937  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1938  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureLvsSeoEtab\");\n" \
1939  " EXEC SQL\n" \
1940  " declare crsLectureLvsSeoEtab\n" \
1941  " cursor\n" \
1942  " for rqtLectureLvsSeoEtab;\n" \
1943  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1944  "\n" \
1945  " if ((int4)GIV::GYBok != iIntRet)\n" \
1946  " {\n" \
1947  " /* Erreur sur declaration curseur SQL */\n" \
1948  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureLvsSeoEtab ...\\n\"));\n" \
1949  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1950  " }\n" \
1951  " }\n" \
1952  " }\n" \
1953  "\n" \
1954  " /* Controle de la longueur du texte de la requete */\n" \
1955  " iLgRequete = strlen(GIV_SLC_LIENS_PROD_ETAB);\n" \
1956  " iLgBuffer = sizeof(cRequete);\n" \
1957  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
1958  "\n" \
1959  " if (iLgBuffer <= iLgRequete)\n" \
1960  " {\n" \
1961  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
1962  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1963  " }\n" \
1964  "\n" \
1965  " /* Construction du texte de la requete */\n" \
1966  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
1967  " {\n" \
1968  " (void)sprintf(cRequete,\n" \
1969  " GIV_SLC_LIENS_PROD_ETAB);\n" \
1970  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
1971  " /* Controle et parsing de la requete SQL */\n" \
1972  " EXEC SQL\n" \
1973  " prepare rqtLectureLiensEtab\n" \
1974  " from: cRequete;\n" \
1975  " /* Traitement des erreurs SQL */\n" \
1976  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureLiensEtab\");\n" \
1977  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1978  "\n" \
1979  " if ((int4)GIV::GYBok != iIntRet)\n" \
1980  " {\n" \
1981  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureLiensEtab : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
1982  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1983  " }\n" \
1984  " else\n" \
1985  " {\n" \
1986  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
1987  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureLiensEtab\");\n" \
1988  " EXEC SQL\n" \
1989  " declare crsLectureLiensEtab\n" \
1990  " cursor\n" \
1991  " for rqtLectureLiensEtab;\n" \
1992  " iIntRet = GYBErreur(&vErreurSQL);\n" \
1993  "\n" \
1994  " if ((int4)GIV::GYBok != iIntRet)\n" \
1995  " {\n" \
1996  " /* Erreur sur declaration curseur SQL */\n" \
1997  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureLiensEtab ...\\n\"));\n" \
1998  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
1999  " }\n" \
2000  " }\n" \
2001  " }\n" \
2002  "\n" \
2003  " /* Controle de la longueur du texte de la requete */\n" \
2004  " iLgRequete = strlen(GIV_SLC_LIENS_PROF_PUB);\n" \
2005  " iLgBuffer = sizeof(cRequete);\n" \
2006  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
2007  "\n" \
2008  " if (iLgBuffer <= iLgRequete)\n" \
2009  " {\n" \
2010  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
2011  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
2012  " }\n" \
2013  "\n" \
2014  " /* Construction du texte de la requete */\n" \
2015  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
2016  " {\n" \
2017  " (void)sprintf(cRequete, GIV_SLC_LIENS_PROF_PUB, GIXcDepartement);\n" \
2018  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
2019  " /* Controle et parsing de la requete SQL */\n" \
2020  " EXEC SQL\n" \
2021  " prepare rqtLectureLiensProfPub\n" \
2022  " from :cRequete;\n" \
2023  " /* Traitement des erreurs SQL */\n" \
2024  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureLiensProfPub\");\n" \
2025  " iIntRet = GYBErreur(&vErreurSQL);\n" \
2026  "\n" \
2027  " if ((int4)GIV::GYBok != iIntRet)\n" \
2028  " {\n" \
2029  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureLiensProfPub : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
2030  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
2031  " }\n" \
2032  " else\n" \
2033  " {\n" \
2034  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
2035  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureLiensProfPub\");\n" \
2036  " EXEC SQL\n" \
2037  " declare crsLectureLiensProfPub\n" \
2038  " cursor\n" \
2039  " for rqtLectureLiensProfPub;\n" \
2040  " iIntRet = GYBErreur(&vErreurSQL);\n" \
2041  "\n" \
2042  " if ((int4)GIV::GYBok != iIntRet)\n" \
2043  " {\n" \
2044  " /* Erreur sur declaration curseur SQL */\n" \
2045  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureLiensProfPub ...\\n\"));\n" \
2046  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
2047  " }\n" \
2048  " }\n" \
2049  " }\n" \
2050  "\n" \
2051  " /* Sortie de la fonction */\n" \
2052  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureEtab/ContenusEtab/EtabMC/SIRET/Pub/Old/LvsSeo/LiensEtab/LiensProfPub\\n\"));\n" \
2053  " return (iCodRet);\n" \
2054  "}\n" \
2055  "\n" \
2056  "/*----Fonction----------------------------------------------------------------*/\n" \
2057  "/* */\n" \
2058  "/* Fonction : givReprise () */\n" \
2059  "/* */\n" \
2060  "/* But : offset de reprise */\n" \
2061  "/* */\n" \
2062  "/* */\n" \
2063  "/* */\n" \
2064  "/* Entree(s) : */\n" \
2065  "/* */\n" \
2066  "/* Sortie(s) : OK ou KO */\n" \
2067  "/* */\n" \
2068  "/* Portable : Transparent */\n" \
2069  "/* */\n" \
2070  "/*----------------------------------------------------------------------------*/\n" \
2071  "\n" \
2072  "static int4 givReprise(void)\n" \
2073  "{\n" \
2074  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
2075  " fpos_t rOffset;\n" \
2076  " /* HAL : fonction modifiée pour Linux : fpos_t est un entier sous AIX, une structure sous Linux */\n" \
2077  " /* fpos64_t a été remplacé par fpos_t, et fgetpos64 a été remplacé par fgetpos */\n" \
2078  "\n" \
2079  " if (NULL != GIVfDescFicMCD)\n" \
2080  " {\n" \
2081  " iCodRet = (int4)fgetpos(GIVfDescFicMCD, &rOffset);\n" \
2082  "\n" \
2083  " if ((int4)GIV::GWCCodeOK != iCodRet)\n" \
2084  " GWTTrace(GWT_NIV_FONCT, (\"Erreur offset reprise %d\\n\", iCodRet));\n" \
2085  " }\n" \
2086  " else\n" \
2087  " {\n" \
2088  " rOffset.__pos = 0;\n" \
2089  " GWTTrace(GWT_NIV_FONCT, (\"Erreur offset reprise \\n\"));\n" \
2090  " }\n" \
2091  "\n" \
2092  " GWTTrace(GWT_NIV_FONCT, (\"Offset reprise %10.0f\\n\", (double)rOffset.__pos));\n" \
2093  " return (iCodRet);\n" \
2094  "}\n" \
2095  "\n" \
2096  "/*----------------------------------Fonction----------------------------------*\n" \
2097  " * Fonction : givCompListObj\n" \
2098  " *\n" \
2099  " * But : Comparaison des objets publicitaires\n" \
2100  " *\n" \
2101  " * Description : comparaison Iamic\n" \
2102  " *\n" \
2103  " * Portabilité : sûrement portable\n" \
2104  " *\n" \
2105  " * Interface :\n" \
2106  " *\n" \
2107  " * Paramètres :\n" \
2108  " *\n" \
2109  " * Valeurs retournées :\n" \
2110  " *\n" \
2111  " * Erreurs :\n" \
2112  " *\n" \
2113  " *---------------------------------Historique----------------------------------\n" \
2114  " *\n" \
2115  " * Création : Jan/29/2008 (mb)\n" \
2116  " *\n" \
2117  " * Modification (MMM/JJ/AAAA - xx) :\n" \
2118  " *\n" \
2119  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
2120  "\n" \
2121  "static int4 givCompListObj(const void* apList1, const void* apList2)\n" \
2122  "{\n" \
2123  " return givrListObj.givCompListObj(apList1, apList2, doc2);\n" \
2124  "}\n" \
2125  "\n" \
2126  "/*----------------------------------Fonction----------------------------------*\n" \
2127  " * Fonction : givAjoutListCRC\n" \
2128  " *\n" \
2129  " * But : Ajout de crc\n" \
2130  " *\n" \
2131  " * Description : ajout crc dans liste si absent\n" \
2132  " *\n" \
2133  " * Portabilité : sûrement portable\n" \
2134  " *\n" \
2135  " * Interface :\n" \
2136  " *\n" \
2137  " * Paramètres :\n" \
2138  " *\n" \
2139  " * Valeurs retournées :\n" \
2140  " *\n" \
2141  " * Erreurs :\n" \
2142  " *\n" \
2143  " *---------------------------------Historique----------------------------------\n" \
2144  " *\n" \
2145  " * Création : Nov/18/2013 (mb)\n" \
2146  " *\n" \
2147  " * Modification (MMM/JJ/AAAA - xx) :\n" \
2148  " *\n" \
2149  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
2150  "static int4 givAjoutListCRC(GYBrPrioCRCT rPrioCRC)\n" \
2151  "{\n" \
2152  " /** code retour des fonctions appelées */\n" \
2153  " int4 iCodRet;\n" \
2154  " int4 i;\n" \
2155  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
2156  "\n" \
2157  " for (i = 0; i < givrListCRC.iNbr; i++)\n" \
2158  " {\n" \
2159  " if ((0 == strcmp(rPrioCRC.acEtab, givrListCRC.trEltList[i].acEtab)) && (0 == strcmp(rPrioCRC.acTpdsob, givrListCRC.trEltList[i].acTpdsob))\n" \
2160  " && (0 == strcmp(rPrioCRC.acCRC, givrListCRC.trEltList[i].acCRC)) && (0 == strcmp(rPrioCRC.acCodan8, givrListCRC.trEltList[i].acCodan8))\n" \
2161  " && (0 == strcmp(rPrioCRC.acType, givrListCRC.trEltList[i].acType)) && (rPrioCRC.iPrioCRC == givrListCRC.trEltList[i].iPrioCRC))\n" \
2162  " {\n" \
2163  " /* crc en double */\n" \
2164  " break;\n" \
2165  " }\n" \
2166  " }\n" \
2167  "\n" \
2168  " giviNbCRC = givrListCRC.iNbr;\n" \
2169  "\n" \
2170  " if ((MAX_LIST_CRC == giviNbCRC) && (givrListCRC.iNbr == i))\n" \
2171  " {\n" \
2172  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
2173  " GWTTrace(GWT_NIV_GRAVE, (\" Nombre de ref CRC atteint %d\\n\", giviNbCRC));\n" \
2174  " }\n" \
2175  " else if (givrListCRC.iNbr == i)\n" \
2176  " {\n" \
2177  " (void)strcpy(givrListCRC.trEltList[giviNbCRC].acTpdsob, rPrioCRC.acTpdsob);\n" \
2178  " (void)strcpy(givrListCRC.trEltList[giviNbCRC].acCodan8, rPrioCRC.acCodan8);\n" \
2179  " (void)strcpy(givrListCRC.trEltList[giviNbCRC].acType, rPrioCRC.acType);\n" \
2180  " (void)strcpy(givrListCRC.trEltList[giviNbCRC].acEtab, rPrioCRC.acEtab);\n" \
2181  " (void)strcpy(givrListCRC.trEltList[giviNbCRC].acCRC, rPrioCRC.acCRC);\n" \
2182  " givrListCRC.trEltList[giviNbCRC].iPrioCRC = rPrioCRC.iPrioCRC;\n" \
2183  " givrListCRC.trEltRangList[giviNbCRC] = giviNbCRC;\n" \
2184  " giviNbCRC++;\n" \
2185  " givrListCRC.iNbr = giviNbCRC;\n" \
2186  " }\n" \
2187  "\n" \
2188  " return (iCodRet);\n" \
2189  "}\n" \
2190  "\n" \
2191  "/*----------------------------------Fonction----------------------------------*\n" \
2192  " * Fonction : givCompListCRC\n" \
2193  " *\n" \
2194  " * But : Comparaison des crc\n" \
2195  " *\n" \
2196  " * Description : comparaison etab,crc,an8,type\n" \
2197  " *\n" \
2198  " * Portabilité : sûrement portable\n" \
2199  " *\n" \
2200  " * Interface :\n" \
2201  " *\n" \
2202  " * Paramètres :\n" \
2203  " *\n" \
2204  " * Valeurs retournées :\n" \
2205  " *\n" \
2206  " * Erreurs :\n" \
2207  " *\n" \
2208  " *---------------------------------Historique----------------------------------\n" \
2209  " *\n" \
2210  " * Création : Oct/04/2012 (mb)\n" \
2211  " *\n" \
2212  " * Modification (MMM/JJ/AAAA - xx) :\n" \
2213  " *\n" \
2214  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
2215  "static int4 givCompListCRC(const void* apList1, const void* apList2)\n" \
2216  "{\n" \
2217  " /** code retour des fonctions appelées */\n" \
2218  " int4 iRetour;\n" \
2219  " /** pointeur sur le rang du premier code à comparer */\n" \
2220  " int4 iList1;\n" \
2221  " /** pointeur sur le rang du second code à comparer */\n" \
2222  " int4 iList2;\n" \
2223  " /** Initialisation des pointeurs */\n" \
2224  " iList1 = *(int4*)apList1;\n" \
2225  " iList2 = *(int4*)apList2;\n" \
2226  "\n" \
2227  " if ((0 == strlen(givrListCRC.trEltList[iList1].acEtab)) && (0 != strlen(givrListCRC.trEltList[iList2].acEtab)))\n" \
2228  " return (1);\n" \
2229  "\n" \
2230  " if ((0 != strlen(givrListCRC.trEltList[iList1].acEtab)) && (0 == strlen(givrListCRC.trEltList[iList2].acEtab)))\n" \
2231  " return (-1);\n" \
2232  "\n" \
2233  " iRetour = strcmp(givrListCRC.trEltList[iList1].acEtab, givrListCRC.trEltList[iList2].acEtab);\n" \
2234  "\n" \
2235  " if (0 != iRetour)\n" \
2236  " return (iRetour);\n" \
2237  " else\n" \
2238  " {\n" \
2239  " iRetour = strcmp(givrListCRC.trEltList[iList1].acCodan8, givrListCRC.trEltList[iList2].acCodan8);\n" \
2240  "\n" \
2241  " if (0 != iRetour)\n" \
2242  " return (iRetour);\n" \
2243  " else\n" \
2244  " {\n" \
2245  " iRetour = strcmp(givrListCRC.trEltList[iList1].acCRC, givrListCRC.trEltList[iList2].acCRC);\n" \
2246  "\n" \
2247  " if (0 != iRetour)\n" \
2248  " return (iRetour);\n" \
2249  " else\n" \
2250  " {\n" \
2251  " iRetour = strcmp(givrListCRC.trEltList[iList1].acType, givrListCRC.trEltList[iList2].acType);\n" \
2252  "\n" \
2253  " if (0 != iRetour)\n" \
2254  " return (iRetour);\n" \
2255  " else\n" \
2256  " {\n" \
2257  " iRetour = strcmp(givrListCRC.trEltList[iList1].acTpdsob, givrListCRC.trEltList[iList2].acTpdsob);\n" \
2258  "\n" \
2259  " if (0 != iRetour)\n" \
2260  " return (iRetour);\n" \
2261  " else\n" \
2262  " {\n" \
2263  " if (GIV::GIXCodeOK == givrListCRC.trEltList[iList1].iPrioCRC && GIV::GIXCodeOK != givrListCRC.trEltList[iList2].iPrioCRC)\n" \
2264  " return (-1);\n" \
2265  " else if (GIV::GIXCodeOK != givrListCRC.trEltList[iList1].iPrioCRC && GIV::GIXCodeOK == givrListCRC.trEltList[iList2].iPrioCRC)\n" \
2266  " return (1);\n" \
2267  "\n" \
2268  " return (0);\n" \
2269  " }\n" \
2270  " }\n" \
2271  " }\n" \
2272  " }\n" \
2273  " }\n" \
2274  "}\n" \
2275  "\n" \
2276  "/*----------------------------------Fonction----------------------------------*\n" \
2277  " * Fonction : givCompListInst\n" \
2278  " *\n" \
2279  " * But : Comparaison des codes géographiques d'installation\n" \
2280  " *\n" \
2281  " * Description : comparaison dept/loc/arr d'installation\n" \
2282  " *\n" \
2283  " * Portabilité : sûrement portable\n" \
2284  " *\n" \
2285  " * Interface :\n" \
2286  " *\n" \
2287  " * Paramètres :\n" \
2288  " *\n" \
2289  " * Valeurs retournées :\n" \
2290  " *\n" \
2291  " * Erreurs :\n" \
2292  " *\n" \
2293  " *---------------------------------Historique----------------------------------\n" \
2294  " *\n" \
2295  " * Création : Jan/29/2008 (mb)\n" \
2296  " *\n" \
2297  " * Modification (MMM/JJ/AAAA - xx) :\n" \
2298  " *\n" \
2299  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
2300  "\n" \
2301  "static int4 givCompListInst(const void* apList1, const void* apList2)\n" \
2302  "{\n" \
2303  " return givrListInst.givCompareListe(apList1, apList2);\n" \
2304  "}\n" \
2305  "static int4 givCompListAn9Inst(const void* apList1, const void* apList2)\n" \
2306  "{\n" \
2307  " /** code retour des fonctions appelées */\n" \
2308  " int4 iRetour;\n" \
2309  " /** pointeur sur le rang du premier code à comparer */\n" \
2310  " int4 iList1;\n" \
2311  " /** pointeur sur le rang du second code à comparer */\n" \
2312  " int4 iList2;\n" \
2313  " /** Initialisation des pointeurs */\n" \
2314  " iList1 = *(int4*)apList1;\n" \
2315  " iList2 = *(int4*)apList2;\n" \
2316  " iRetour = strcmp(givrListInst.trEltList[iList1].rub, givrListInst.trEltList[iList2].rub);\n" \
2317  "\n" \
2318  " if (0 != iRetour)\n" \
2319  " return (iRetour);\n" \
2320  " else\n" \
2321  " {\n" \
2322  " iRetour = (int4)givrListInst.trEltList[iList1].iRgLigne - givrListInst.trEltList[iList2].iRgLigne;\n" \
2323  " return (iRetour);\n" \
2324  " }\n" \
2325  "}\n" \
2326  "static int4 givCompListDenomInst(const void* apList1, const void* apList2)\n" \
2327  "{\n" \
2328  " /** code retour des fonctions appelées */\n" \
2329  " int4 iRetour;\n" \
2330  " /** pointeur sur le rang du premier code à comparer */\n" \
2331  " int4 iList1;\n" \
2332  " /** pointeur sur le rang du second code à comparer */\n" \
2333  " int4 iList2;\n" \
2334  " /** Initialisation des pointeurs */\n" \
2335  " iList1 = *(int4*)apList1;\n" \
2336  " iList2 = *(int4*)apList2;\n" \
2337  " iList1 = givrListInst.trEltList[iList1].iRgLigne;\n" \
2338  " iList2 = givrListInst.trEltList[iList2].iRgLigne;\n" \
2339  " iRetour = strcmp((doc2 + iList1)->value.intitule.denomination, (doc2 + iList2)->value.intitule.denomination);\n" \
2340  "\n" \
2341  " if (0 != iRetour)\n" \
2342  " return (iRetour);\n" \
2343  " else\n" \
2344  " {\n" \
2345  " iRetour = (int4)iList1 - iList2;\n" \
2346  " return (iRetour);\n" \
2347  " }\n" \
2348  "}\n" \
2349  "\n" \
2350  "/*----------------------------------Fonction----------------------------------*\n" \
2351  " * Fonction : givCompListParu\n" \
2352  " *\n" \
2353  " * But : Comparaison des codes géographiques de parution\n" \
2354  " *\n" \
2355  " * Description : comparaison dept/loc/arr de parution\n" \
2356  " *\n" \
2357  " * Portabilité : sûrement portable\n" \
2358  " *\n" \
2359  " * Interface :\n" \
2360  " *\n" \
2361  " * Paramètres :\n" \
2362  " *\n" \
2363  " * Valeurs retournées :\n" \
2364  " *\n" \
2365  " * Erreurs :\n" \
2366  " *\n" \
2367  " *---------------------------------Historique----------------------------------\n" \
2368  " *\n" \
2369  " * Création : Jan/29/2008 (mb)\n" \
2370  " *\n" \
2371  " * Modification (MMM/JJ/AAAA - xx) :\n" \
2372  " *\n" \
2373  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
2374  "\n" \
2375  "static int4 givCompListParu(const void* apList1, const void* apList2)\n" \
2376  "{\n" \
2377  " int4 iRetour = givrListParu.givCompareListe(apList1, apList2);\n" \
2378  " if (0 != iRetour)\n" \
2379  " return (iRetour);\n" \
2380  " else\n" \
2381  " return givrListParu.givCompiLFiZU(apList1, apList2);\n" \
2382  "}\n" \
2383  "\n" \
2384  "static int4 givCompListAn9Paru(const void* apList1, const void* apList2)\n" \
2385  "{\n" \
2386  " /** code retour des fonctions appelées */\n" \
2387  " int4 iRetour;\n" \
2388  " /** pointeur sur le rang du premier code à comparer */\n" \
2389  " int4 iList1;\n" \
2390  " /** pointeur sur le rang du second code à comparer */\n" \
2391  " int4 iList2;\n" \
2392  " /** Initialisation des pointeurs */\n" \
2393  " iList1 = *(int4*)apList1;\n" \
2394  " iList2 = *(int4*)apList2;\n" \
2395  " iRetour = strcmp(givrListParu.trEltList[iList1].rub, givrListParu.trEltList[iList2].rub);\n" \
2396  "\n" \
2397  " if (0 != iRetour)\n" \
2398  " return (iRetour);\n" \
2399  " else\n" \
2400  " {\n" \
2401  " iRetour = (int4)givrListParu.trEltList[iList1].iRgLigne - givrListParu.trEltList[iList2].iRgLigne;\n" \
2402  " return (iRetour);\n" \
2403  " }\n" \
2404  "}\n" \
2405  "static int4 givCompListDenomParu(const void* apList1, const void* apList2)\n" \
2406  "{\n" \
2407  " /** code retour des fonctions appelées */\n" \
2408  " int4 iRetour;\n" \
2409  " /** pointeur sur le rang du premier code à comparer */\n" \
2410  " int4 iList1;\n" \
2411  " /** pointeur sur le rang du second code à comparer */\n" \
2412  " int4 iList2;\n" \
2413  " /** Initialisation des pointeurs */\n" \
2414  " iList1 = *(int4*)apList1;\n" \
2415  " iList2 = *(int4*)apList2;\n" \
2416  " iList1 = givrListParu.trEltList[iList1].iRgLigne;\n" \
2417  " iList2 = givrListParu.trEltList[iList2].iRgLigne;\n" \
2418  " iRetour = strcmp((doc2 + iList1)->value.intitule.denomination, (doc2 + iList2)->value.intitule.denomination);\n" \
2419  "\n" \
2420  " if (0 != iRetour)\n" \
2421  " return (iRetour);\n" \
2422  " else\n" \
2423  " {\n" \
2424  " iRetour = (int4)iList1 - iList2;\n" \
2425  " return (iRetour);\n" \
2426  " }\n" \
2427  "}\n" \
2428  "\n" \
2429  "/*----------------------------------Fonction----------------------------------*\n" \
2430  " * Fonction : givCompListParuTaille\n" \
2431  " *\n" \
2432  " * But : Comparaison des codes géographiques de parution par taille de blocs\n" \
2433  " * rub/geo\n" \
2434  " *\n" \
2435  " * Description : comparaison dept/loc/arr de parution\n" \
2436  " *\n" \
2437  " * Portabilité : sûrement portable\n" \
2438  " *\n" \
2439  " * Interface :\n" \
2440  " *\n" \
2441  " * Paramètres :\n" \
2442  " *\n" \
2443  " * Valeurs retournées :\n" \
2444  " *\n" \
2445  " * Erreurs :\n" \
2446  " *\n" \
2447  " *---------------------------------Historique----------------------------------\n" \
2448  " *\n" \
2449  " * Création : Av/08/2008 (mb)\n" \
2450  " *\n" \
2451  " * Modification (MMM/JJ/AAAA - xx) :\n" \
2452  " *\n" \
2453  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
2454  "\n" \
2455  "static int4 givCompListParuTaille(const void* apList1, const void* apList2)\n" \
2456  "{\n" \
2457  " /** code retour des fonctions appelées */\n" \
2458  " int4 iRetour;\n" \
2459  " /** pointeur sur le rang du premier code à comparer */\n" \
2460  " int4 iList1;\n" \
2461  " /** pointeur sur le rang du second code à comparer */\n" \
2462  " int4 iList2;\n" \
2463  " /** Initialisation des pointeurs */\n" \
2464  " iList1 = *(int4*)apList1;\n" \
2465  " iList2 = *(int4*)apList2;\n" \
2466  "\n" \
2467  " if (((int4) - 1 == (int4)givrListParu.trEltList[iList1].iRgGeoTri) && ((int4) - 1 != (int4)givrListParu.trEltList[iList2].iRgGeoTri))\n" \
2468  " return (1);\n" \
2469  "\n" \
2470  " if (((int4) - 1 != (int4)givrListParu.trEltList[iList1].iRgGeoTri) && ((int4) - 1 == (int4)givrListParu.trEltList[iList2].iRgGeoTri))\n" \
2471  " return (-1);\n" \
2472  "\n" \
2473  " iRetour = (int4)givrListParu.trEltList[iList1].iNbGeoTri - givrListParu.trEltList[iList2].iNbGeoTri;\n" \
2474  "\n" \
2475  " if (0 != iRetour)\n" \
2476  " return (iRetour);\n" \
2477  "\n" \
2478  " iRetour = (int4)givrListParu.trEltList[iList1].iRgTriDblBis - givrListParu.trEltList[iList2].iRgTriDblBis;\n" \
2479  "\n" \
2480  " if (0 != iRetour)\n" \
2481  " return (iRetour);\n" \
2482  "\n" \
2483  " iRetour = (int4)givrListParu.trEltList[iList1].iRangTri - givrListParu.trEltList[iList2].iRangTri;\n" \
2484  "\n" \
2485  " if (0 != iRetour)\n" \
2486  " return (iRetour);\n" \
2487  "\n" \
2488  " iRetour = (int4)givrListParu.trEltList[iList1].iRgGeoTri - givrListParu.trEltList[iList2].iRgGeoTri;\n" \
2489  " return (iRetour);\n" \
2490  "}\n" \
2491  "\n" \
2492  "/*----------------------------------Fonction----------------------------------*\n" \
2493  " * Fonction : givCompListInstTaille\n" \
2494  " *\n" \
2495  " * But : Comparaison des codes géographiques d'installation par taille de blocs\n" \
2496  " * rub/geo\n" \
2497  " *\n" \
2498  " * Description : comparaison dept/loc/arr de parution\n" \
2499  " *\n" \
2500  " * Portabilité : sûrement portable\n" \
2501  " *\n" \
2502  " * Interface :\n" \
2503  " *\n" \
2504  " * Paramètres :\n" \
2505  " *\n" \
2506  " * Valeurs retournées :\n" \
2507  " *\n" \
2508  " * Erreurs :\n" \
2509  " *\n" \
2510  " *---------------------------------Historique----------------------------------\n" \
2511  " *\n" \
2512  " * Création : Av/08/2008 (mb)\n" \
2513  " *\n" \
2514  " * Modification (MMM/JJ/AAAA - xx) :\n" \
2515  " *\n" \
2516  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
2517  "\n" \
2518  "static int4 givCompListInstTaille(const void* apList1, const void* apList2)\n" \
2519  "{\n" \
2520  " /** code retour des fonctions appelées */\n" \
2521  " int4 iRetour;\n" \
2522  " /** pointeur sur le rang du premier code à comparer */\n" \
2523  " int4 iList1;\n" \
2524  " /** pointeur sur le rang du second code à comparer */\n" \
2525  " int4 iList2;\n" \
2526  " /** Initialisation des pointeurs */\n" \
2527  " iList1 = *(int4*)apList1;\n" \
2528  " iList2 = *(int4*)apList2;\n" \
2529  "\n" \
2530  " if (((int4) - 1 == (int4)givrListInst.trEltList[iList1].iRgGeoTri) && ((int4) - 1 != (int4)givrListInst.trEltList[iList2].iRgGeoTri))\n" \
2531  " return (1);\n" \
2532  "\n" \
2533  " if (((int4) - 1 != (int4)givrListInst.trEltList[iList1].iRgGeoTri) && ((int4) - 1 == (int4)givrListInst.trEltList[iList2].iRgGeoTri))\n" \
2534  " return (-1);\n" \
2535  "\n" \
2536  " iRetour = (int4)givrListInst.trEltList[iList1].iNbGeoTri - givrListInst.trEltList[iList2].iNbGeoTri;\n" \
2537  "\n" \
2538  " if (0 != iRetour)\n" \
2539  " return (iRetour);\n" \
2540  "\n" \
2541  " iRetour = (int4)givrListInst.trEltList[iList1].iRangTri - givrListInst.trEltList[iList2].iRangTri;\n" \
2542  "\n" \
2543  " if (0 != iRetour)\n" \
2544  " return (iRetour);\n" \
2545  "\n" \
2546  " iRetour = (int4)givrListInst.trEltList[iList1].iRgGeoTri - givrListInst.trEltList[iList2].iRgGeoTri;\n" \
2547  " return (iRetour);\n" \
2548  "}\n" \
2549  "\n" \
2550  "/*----------------------------------Fonction----------------------------------*\n" \
2551  " * Fonction : givInitTriAn9Geo\n" \
2552  " *\n" \
2553  " * But : init Tri des codes géographiques\n" \
2554  " *\n" \
2555  " * Description : init du rang de rubrique\n" \
2556  " *\n" \
2557  " * Portabilité : sûrement portable\n" \
2558  " *\n" \
2559  " * Interface :\n" \
2560  " *\n" \
2561  " * Paramètres :\n" \
2562  " *\n" \
2563  " * Valeurs retournées :\n" \
2564  " *\n" \
2565  " * Erreurs :\n" \
2566  " *\n" \
2567  " *---------------------------------Historique----------------------------------\n" \
2568  " *\n" \
2569  " * Création : Jan/29/2008 (mb)\n" \
2570  " *\n" \
2571  " * Modification (MMM/JJ/AAAA - xx) :\n" \
2572  " *\n" \
2573  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
2574  "\n" \
2575  "int4 givInitTriAn9Geo(void)\n" \
2576  "{\n" \
2577  " int4 iCodRet; /* Code retour de la fonction */\n" \
2578  " int4 iIntRet; /* Code retour interne */\n" \
2579  " int4 i, j, k, l, m, n;\n" \
2580  " int4 iGeo;\n" \
2581  " int4 iVal;\n" \
2582  " char tcAn9Courant[GYBPaprofLgCodan9 + 1];\n" \
2583  " int4 iRangRub, iRgRubDbl, iNbGeoRub, iRgGeoRub, iRangDeb, iNbrRub;\n" \
2584  " int4 iNbrParuMax, iNbrInstMax;\n" \
2585  " /* trier en fonction des an9 */\n" \
2586  " qsort(givrListParu.trEltRangList, givrListParu.iNbr, sizeof(int4), givCompListAn9Paru);\n" \
2587  " qsort(givrListInst.trEltRangList, givrListInst.iNbr, sizeof(int4), givCompListAn9Inst);\n" \
2588  " iNbrInstMax = givrListInst.iNbr;\n" \
2589  " iNbrParuMax = givrListParu.iNbr;\n" \
2590  " strcpy(tcAn9Courant, givcR00000000);\n" \
2591  " iRangRub = -1;\n" \
2592  "\n" \
2593  " /* analyse paru par rubrique */\n" \
2594  " for (i = 0; i < iNbrParuMax; i++)\n" \
2595  " {\n" \
2596  " k = givrListParu.trEltRangList[i];\n" \
2597  "\n" \
2598  " if ((0 != strcmp(tcAn9Courant, givrListParu.trEltList[k].rub)) || (0 == i))\n" \
2599  " {\n" \
2600  " strcpy(tcAn9Courant, givrListParu.trEltList[k].rub);\n" \
2601  " iRangRub++;\n" \
2602  "\n" \
2603  " /* init arr si LF */\n" \
2604  " for (m = 0; m < 3; m++)\n" \
2605  " givtrRefArr[m + 3].nbarr = givtrRefArr[m].nbarr;\n" \
2606  "\n" \
2607  " /* Init d'une installation par défaut */\n" \
2608  " for (j = 0; j < iNbrInstMax; j++)\n" \
2609  " {\n" \
2610  " l = givrListInst.trEltRangList[j];\n" \
2611  "\n" \
2612  " if (0 == strcmp(givrListInst.trEltList[l].rub, givrListParu.trEltList[k].rub))\n" \
2613  " break;\n" \
2614  " }\n" \
2615  "\n" \
2616  " if ((iNbrInstMax == j) && (MAX_LIST != givrListInst.iNbr))\n" \
2617  " {\n" \
2618  " /* ajout défaut */\n" \
2619  " iGeo = givrListInst.iNbr;\n" \
2620  " (void)strcpy(givrListInst.trEltList[iGeo].rub, givrListParu.trEltList[k].rub);\n" \
2621  " (void)strcpy(givrListInst.trEltList[iGeo].rubinit, givrListParu.trEltList[k].rubinit);\n" \
2622  " (void)strcpy(givrListInst.trEltList[iGeo].dep, \"999\");\n" \
2623  " (void)strcpy(givrListInst.trEltList[iGeo].loc, \"99999\");\n" \
2624  " (void)strcpy(givrListInst.trEltList[iGeo].arr, \"99\");\n" \
2625  " (void)strcpy(givrListInst.trEltList[iGeo].reg, \"99\");\n" \
2626  " givrListInst.trEltList[iGeo].iRgLigne = (int4)GIV::GIXCodeKO;\n" \
2627  " givrListInst.trEltList[iGeo].iGeo = 99;\n" \
2628  " givrListInst.trEltList[iGeo].iGeoReg = 99;\n" \
2629  " givrListInst.trEltList[iGeo].iGeoDept = 99;\n" \
2630  " givrListInst.trEltList[iGeo].iGeoLoc = 99;\n" \
2631  " givrListInst.trEltList[iGeo].iGeoArr = 99;\n" \
2632  " givrListInst.trEltRangList[iGeo] = iGeo;\n" \
2633  " givrListInst.iNbr++;\n" \
2634  " }\n" \
2635  " else if (iNbrInstMax == j)\n" \
2636  " {\n" \
2637  " /* Trop d'entrées internes */\n" \
2638  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
2639  " }\n" \
2640  " }\n" \
2641  "\n" \
2642  " givrListParu.trEltList[k].iRangTri = iRangRub;\n" \
2643  "\n" \
2644  " /* analyse localité fictive par rubrique */\n" \
2645  " if (0 == strcmp(givrListParu.trEltList[k].loc, givcLocFictive))\n" \
2646  " {\n" \
2647  " for (m = 0; m < 6; m++)\n" \
2648  " {\n" \
2649  " /* parution LF avec arrondissement */\n" \
2650  " if ((0 == strcmp(givtrRefArr[m].dep, givrListParu.trEltList[k].dep)) && (0 == strcmp(givtrRefArr[m].loc, givrListParu.trEltList[k].loc)))\n" \
2651  " break;\n" \
2652  " }\n" \
2653  "\n" \
2654  " if (6 != m)\n" \
2655  " {\n" \
2656  " for (j = 1; j < (givtrRefArr[m].nbarr + 1); j++)\n" \
2657  " {\n" \
2658  " iGeo = givrListParu.iNbr;\n" \
2659  "\n" \
2660  " if (MAX_LIST == iGeo)\n" \
2661  " {\n" \
2662  " /* Trop d'entrées internes */\n" \
2663  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
2664  " break;\n" \
2665  " }\n" \
2666  "\n" \
2667  " /* givrListParu.trEltList[iGeo].iRgLigne = (int4)GIV::GIXCodeKO; */\n" \
2668  " givrListParu.trEltList[iGeo].iRgLigne = givrListParu.trEltList[k].iRgLigne;\n" \
2669  " givrListParu.trEltList[iGeo].iRgDnom = givrListParu.trEltList[k].iRgDnom;\n" \
2670  " (void)strcpy(givrListParu.trEltList[iGeo].tcRgDnom, givrListParu.trEltList[k].tcRgDnom);\n" \
2671  " givrListParu.trEltList[iGeo].iRangTri = givrListParu.trEltList[k].iRangTri;\n" \
2672  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
2673  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
2674  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
2675  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
2676  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
2677  "\n" \
2678  " if (0 != strcmp(\"075\", givrListParu.trEltList[k].dep))\n" \
2679  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
2680  " else\n" \
2681  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
2682  "\n" \
2683  " (void)strcpy(givrListParu.trEltList[iGeo].rub, givrListParu.trEltList[k].rub);\n" \
2684  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, givrListParu.trEltList[k].rubinit);\n" \
2685  " (void)strcpy(givrListParu.trEltList[iGeo].nature, givrListParu.trEltList[k].nature);\n" \
2686  " givrListParu.trEltList[iGeo].iRangTri = givrListParu.trEltList[k].iRangTri;\n" \
2687  " (void)strcpy(givrListParu.trEltList[iGeo].dep, givrListParu.trEltList[k].dep);\n" \
2688  " (void)strcpy(givrListParu.trEltList[iGeo].loc, givtrRefArr[m - 3].loc);\n" \
2689  " iVal = j;\n" \
2690  "\n" \
2691  " for (l = 1; l >= 0; l--)\n" \
2692  " {\n" \
2693  " givrListParu.trEltList[iGeo].arr[l] = (char)((iVal % 10) + '0');\n" \
2694  " iVal = iVal / 10;\n" \
2695  " }\n" \
2696  "\n" \
2697  " (void)strcpy(givrListParu.trEltList[iGeo].reg, givtrRefArr[m - 3].reg);\n" \
2698  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeKO;\n" \
2699  " givrListParu.trEltList[iGeo].cParuloc = givrListParu.trEltList[k].cParuloc;\n" \
2700  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
2701  " givrListParu.iNbr++;\n" \
2702  " }\n" \
2703  "\n" \
2704  " /* LF a ne plus traiter */\n" \
2705  " givtrRefArr[m].nbarr = 0;\n" \
2706  " }\n" \
2707  " }\n" \
2708  " }\n" \
2709  "\n" \
2710  " /* nombre de rubriques */\n" \
2711  " givrListParu.iNbrTri = iRangRub + 1;\n" \
2712  " strcpy(tcAn9Courant, givcR00000000);\n" \
2713  " iRangRub = -1;\n" \
2714  "\n" \
2715  " /* analyse inst par rubrique */\n" \
2716  " for (i = 0; i < givrListInst.iNbr; i++)\n" \
2717  " {\n" \
2718  " k = givrListInst.trEltRangList[i];\n" \
2719  "\n" \
2720  " if ((0 != strcmp(tcAn9Courant, givrListInst.trEltList[k].rub)) || (0 == i))\n" \
2721  " {\n" \
2722  " iRangRub++;\n" \
2723  " strcpy(tcAn9Courant, givrListInst.trEltList[k].rub);\n" \
2724  " }\n" \
2725  "\n" \
2726  " givrListInst.trEltList[k].iRangTri = iRangRub;\n" \
2727  " }\n" \
2728  "\n" \
2729  " return (iCodRet);\n" \
2730  "}\n" \
2731  "\n" \
2732  "/*----------------------------------Fonction----------------------------------*\n" \
2733  " * Fonction : givInitTriDenomGeo\n" \
2734  " *\n" \
2735  " * But : init Tri des codes géographiques\n" \
2736  " *\n" \
2737  " * Description : init du rang de denomination\n" \
2738  " *\n" \
2739  " * Portabilité : sûrement portable\n" \
2740  " *\n" \
2741  " * Interface :\n" \
2742  " *\n" \
2743  " * Paramètres :\n" \
2744  " *\n" \
2745  " * Valeurs retournées :\n" \
2746  " *\n" \
2747  " * Erreurs :\n" \
2748  " *\n" \
2749  " *---------------------------------Historique----------------------------------\n" \
2750  " *\n" \
2751  " * Création : Jan/29/2008 (mb)\n" \
2752  " *\n" \
2753  " * Modification (MMM/JJ/AAAA - xx) :\n" \
2754  " *\n" \
2755  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
2756  "\n" \
2757  "int4 givInitTriDenomGeo(int4 iTri)\n" \
2758  "{\n" \
2759  " int4 iCodRet; /* Code retour de la fonction */\n" \
2760  " int4 iIntRet; /* Code retour interne */\n" \
2761  " int4 i, ii, j, k, kk, ll, l, m, n;\n" \
2762  " int4 iGeo;\n" \
2763  " int4 iVal;\n" \
2764  " GYBstrIeinscDenomT rDenom;\n" \
2765  " int4 iRang;\n" \
2766  " int4 iNbrParuMax, iNbrInstMax;\n" \
2767  "\n" \
2768  " if (GIV::giv_DNOM != iTri)\n" \
2769  " {\n" \
2770  " /* analyse paru par dénomination */\n" \
2771  " for (i = 0; i < givrListParu.iNbr; i++)\n" \
2772  " {\n" \
2773  " k = givrListParu.trEltRangList[i];\n" \
2774  " kk = givrListParu.trEltList[k].iRgLigne;\n" \
2775  " givrListParu.trEltList[k].iRgDnom = (doc2 + kk)->value.intitule.iRgDnom;\n" \
2776  " (void)strcpy(givrListParu.trEltList[k].tcRgDnom, (doc2 + kk)->value.intitule.tcRgDnom);\n" \
2777  " }\n" \
2778  "\n" \
2779  " /* analyse inst par dénomination */\n" \
2780  " for (i = 0; i < givrListInst.iNbr; i++)\n" \
2781  " {\n" \
2782  " k = givrListInst.trEltRangList[i];\n" \
2783  " kk = givrListInst.trEltList[k].iRgLigne;\n" \
2784  " givrListInst.trEltList[k].iRgDnom = (doc2 + kk)->value.intitule.iRgDnom;\n" \
2785  " (void)strcpy(givrListInst.trEltList[k].tcRgDnom, (doc2 + kk)->value.intitule.tcRgDnom);\n" \
2786  " }\n" \
2787  " }\n" \
2788  " else\n" \
2789  " {\n" \
2790  " iRang = -1;\n" \
2791  "\n" \
2792  " /* analyse paru par dénomination */\n" \
2793  " for (i = 0; i < givrListParu.iNbr; i++)\n" \
2794  " {\n" \
2795  " k = givrListParu.trEltRangList[i];\n" \
2796  " givrListParu.trEltList[k].iRangTri = givrListParu.trEltList[k].iRgDnom;\n" \
2797  "\n" \
2798  " if (givrListParu.trEltList[k].iRangTri > iRang)\n" \
2799  " iRang = givrListParu.trEltList[k].iRangTri;\n" \
2800  " }\n" \
2801  "\n" \
2802  " /* nombre de denominations */\n" \
2803  " givrListParu.iNbrTri = iRang + 1;\n" \
2804  " iRang = -1;\n" \
2805  "\n" \
2806  " /* analyse inst par dénomination */\n" \
2807  " for (i = 0; i < givrListInst.iNbr; i++)\n" \
2808  " {\n" \
2809  " k = givrListInst.trEltRangList[i];\n" \
2810  " givrListInst.trEltList[k].iRangTri = givrListInst.trEltList[k].iRgDnom;\n" \
2811  "\n" \
2812  " if (givrListInst.trEltList[k].iRangTri > iRang)\n" \
2813  " iRang = givrListInst.trEltList[k].iRangTri;\n" \
2814  " }\n" \
2815  "\n" \
2816  " /* nombre de denominations */\n" \
2817  " givrListInst.iNbrTri = iRang + 1;\n" \
2818  " }\n" \
2819  "\n" \
2820  " return (iCodRet);\n" \
2821  " /* trier en fonction des dénominations */\n" \
2822  " qsort(givrListParu.trEltRangList, givrListParu.iNbr, sizeof(int4), givCompListDenomParu);\n" \
2823  " qsort(givrListInst.trEltRangList, givrListInst.iNbr, sizeof(int4), givCompListDenomInst);\n" \
2824  " iNbrInstMax = givrListInst.iNbr;\n" \
2825  " iNbrParuMax = givrListParu.iNbr;\n" \
2826  " strcpy(rDenom, \" \");\n" \
2827  " iRang = -1;\n" \
2828  "\n" \
2829  " /* analyse paru par dénomination */\n" \
2830  " for (i = 0; i < iNbrParuMax; i++)\n" \
2831  " {\n" \
2832  " k = givrListParu.trEltRangList[i];\n" \
2833  " kk = givrListParu.trEltList[k].iRgLigne;\n" \
2834  "\n" \
2835  " if ((0 != strcmp(rDenom, (doc2 + kk)->value.intitule.denomination)) || (0 == i))\n" \
2836  " {\n" \
2837  " strcpy(rDenom, (doc2 + kk)->value.intitule.denomination);\n" \
2838  " iRang++;\n" \
2839  "\n" \
2840  " /* init arr si LF */\n" \
2841  " for (m = 0; m < 3; m++)\n" \
2842  " givtrRefArr[m + 3].nbarr = givtrRefArr[m].nbarr;\n" \
2843  "\n" \
2844  " /* Init d'une installation par défaut */\n" \
2845  " for (j = 0; j < iNbrInstMax; j++)\n" \
2846  " {\n" \
2847  " l = givrListInst.trEltRangList[j];\n" \
2848  " ll = givrListInst.trEltList[l].iRgLigne;\n" \
2849  "\n" \
2850  " if (0 == strcmp((doc2 + ll)->value.intitule.denomination, (doc2 + kk)->value.intitule.denomination))\n" \
2851  " break;\n" \
2852  " }\n" \
2853  "\n" \
2854  " if ((iNbrInstMax == j) && (MAX_LIST == givrListInst.iNbr))\n" \
2855  " {\n" \
2856  " /* Trop d'entrées internes */\n" \
2857  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
2858  " }\n" \
2859  " else if (iNbrInstMax == j)\n" \
2860  " {\n" \
2861  " /* ajout défaut */\n" \
2862  " iGeo = givrListInst.iNbr;\n" \
2863  " (void)strcpy(givrListInst.trEltList[iGeo].rub, givrListParu.trEltList[k].rub);\n" \
2864  " (void)strcpy(givrListInst.trEltList[iGeo].rubinit, givrListParu.trEltList[k].rubinit);\n" \
2865  " (void)strcpy(givrListInst.trEltList[iGeo].dep, \"999\");\n" \
2866  " (void)strcpy(givrListInst.trEltList[iGeo].loc, \"99999\");\n" \
2867  " (void)strcpy(givrListInst.trEltList[iGeo].arr, \"99\");\n" \
2868  " (void)strcpy(givrListInst.trEltList[iGeo].reg, \"99\");\n" \
2869  " givrListInst.trEltList[iGeo].iRgLigne = givrListParu.trEltList[k].iRgLigne;\n" \
2870  " givrListInst.trEltList[iGeo].iRangTri = givrListParu.trEltList[k].iRangTri;\n" \
2871  " givrListInst.trEltList[iGeo].iGeo = 99;\n" \
2872  " givrListInst.trEltList[iGeo].iGeoReg = 99;\n" \
2873  " givrListInst.trEltList[iGeo].iGeoDept = 99;\n" \
2874  " givrListInst.trEltList[iGeo].iGeoLoc = 99;\n" \
2875  " givrListInst.trEltList[iGeo].iGeoArr = 99;\n" \
2876  " givrListInst.trEltRangList[iGeo] = iGeo;\n" \
2877  " givrListInst.iNbr++;\n" \
2878  " }\n" \
2879  " }\n" \
2880  "\n" \
2881  " givrListParu.trEltList[k].iRangTri = iRang;\n" \
2882  "\n" \
2883  " /* analyse localité fictive par dénomination */\n" \
2884  " if (0 == strcmp(givrListParu.trEltList[k].loc, givcLocFictive))\n" \
2885  " {\n" \
2886  " for (m = 0; m < 6; m++)\n" \
2887  " {\n" \
2888  " /* parution LF avec arrondissement */\n" \
2889  " if ((0 == strcmp(givtrRefArr[m].dep, givrListParu.trEltList[k].dep)) && (0 == strcmp(givtrRefArr[m].loc, givrListParu.trEltList[k].loc)))\n" \
2890  " break;\n" \
2891  " }\n" \
2892  "\n" \
2893  " if (6 != m)\n" \
2894  " {\n" \
2895  " for (j = 1; j < (givtrRefArr[m].nbarr + 1); j++)\n" \
2896  " {\n" \
2897  " iGeo = givrListParu.iNbr;\n" \
2898  "\n" \
2899  " if (MAX_LIST == iGeo)\n" \
2900  " {\n" \
2901  " /* Trop d'entrées internes */\n" \
2902  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
2903  " break;\n" \
2904  " }\n" \
2905  "\n" \
2906  " givrListParu.trEltList[iGeo].iRgLigne = (int4)GIV::GIXCodeKO;\n" \
2907  " givrListParu.trEltList[iGeo].iRgLigne = givrListParu.trEltList[k].iRgLigne;\n" \
2908  " givrListParu.trEltList[iGeo].iRangTri = givrListParu.trEltList[k].iRangTri;\n" \
2909  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
2910  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
2911  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
2912  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
2913  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
2914  "\n" \
2915  " if (0 != strcmp(\"075\", givrListParu.trEltList[k].dep))\n" \
2916  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
2917  " else\n" \
2918  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
2919  "\n" \
2920  " (void)strcpy(givrListParu.trEltList[iGeo].rub, givrListParu.trEltList[k].rub);\n" \
2921  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, givrListParu.trEltList[k].rubinit);\n" \
2922  " (void)strcpy(givrListParu.trEltList[iGeo].nature, givrListParu.trEltList[k].nature);\n" \
2923  " givrListParu.trEltList[iGeo].iRangTri = givrListParu.trEltList[k].iRangTri;\n" \
2924  " (void)strcpy(givrListParu.trEltList[iGeo].dep, givrListParu.trEltList[k].dep);\n" \
2925  " (void)strcpy(givrListParu.trEltList[iGeo].loc, givtrRefArr[m - 3].loc);\n" \
2926  " iVal = j;\n" \
2927  "\n" \
2928  " for (l = 1; l >= 0; l--)\n" \
2929  " {\n" \
2930  " givrListParu.trEltList[iGeo].arr[l] = (char)((iVal % 10) + '0');\n" \
2931  " iVal = iVal / 10;\n" \
2932  " }\n" \
2933  "\n" \
2934  " (void)strcpy(givrListParu.trEltList[iGeo].reg, givtrRefArr[m - 3].reg);\n" \
2935  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeKO;\n" \
2936  " givrListParu.trEltList[iGeo].cParuloc = givrListParu.trEltList[k].cParuloc;\n" \
2937  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
2938  " givrListParu.iNbr++;\n" \
2939  " }\n" \
2940  "\n" \
2941  " /* LF a ne plus traiter */\n" \
2942  " givtrRefArr[m].nbarr = 0;\n" \
2943  " }\n" \
2944  " }\n" \
2945  " }\n" \
2946  "\n" \
2947  " /* nombre de denominations */\n" \
2948  " givrListParu.iNbrTri = iRang + 1;\n" \
2949  " strcpy(rDenom, \" \");\n" \
2950  " iRang = -1;\n" \
2951  "\n" \
2952  " /* analyse inst par dénomination */\n" \
2953  " for (i = 0; i < givrListInst.iNbr; i++)\n" \
2954  " {\n" \
2955  " k = givrListInst.trEltRangList[i];\n" \
2956  " kk = givrListInst.trEltList[k].iRgLigne;\n" \
2957  "\n" \
2958  " if ((0 != strcmp(rDenom, (doc2 + kk)->value.intitule.denomination)) || (0 == i))\n" \
2959  " {\n" \
2960  " iRang++;\n" \
2961  " strcpy(rDenom, (doc2 + kk)->value.intitule.denomination);\n" \
2962  " }\n" \
2963  "\n" \
2964  " givrListInst.trEltList[k].iRangTri = iRang;\n" \
2965  " }\n" \
2966  "\n" \
2967  " return (iCodRet);\n" \
2968  "}\n" \
2969  "\n" \
2970  "/*----------------------------------Fonction----------------------------------*\n" \
2971  " * Fonction : givInitTriObjRec\n" \
2972  " *\n" \
2973  " * But : Tri des objets publicitaires réconciliés\n" \
2974  " *\n" \
2975  " * Description : init du rang d'objet\n" \
2976  " *\n" \
2977  " * Portabilité : sûrement portable\n" \
2978  " *\n" \
2979  " * Interface :\n" \
2980  " *\n" \
2981  " * Paramètres :\n" \
2982  " *\n" \
2983  " * Valeurs retournées :\n" \
2984  " *\n" \
2985  " * Erreurs :\n" \
2986  " *\n" \
2987  " *---------------------------------Historique----------------------------------\n" \
2988  " *\n" \
2989  " * Création : Sep/26/2017 (mb)\n" \
2990  " *\n" \
2991  " * Modification (MMM/JJ/AAAA - xx) :\n" \
2992  " *\n" \
2993  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
2994  "\n" \
2995  "int4 givInitTriObjRec(GYBrDOCUMENTEpj* doc, int4 indice, int4 iTri)\n" \
2996  "{\n" \
2997  " int4 iCodRet; /* Code retour de la fonction */\n" \
2998  " int4 iIntRet; /* Code retour interne */\n" \
2999  " int4 i, jj, j, k, kk, l, m;\n" \
3000  " char indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
3001  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
3002  " EXEC SQL begin declare section;\n" \
3003  " GYBrIaprofT rIaprof;\n" \
3004  " EXEC SQL end declare section;\n" \
3005  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
3006  "\n" \
3007  " if (0 == givrListObj.iNbr)\n" \
3008  " {\n" \
3009  " /* pas d'objet publicitaire */\n" \
3010  " if (GIV::giv_OBJ == iTri)\n" \
3011  " givrListParu.iNbrTri = 0;\n" \
3012  "\n" \
3013  " return (iCodRet);\n" \
3014  " }\n" \
3015  "\n" \
3016  " for (i = 0; i < indice; i++)\n" \
3017  " {\n" \
3018  " if ('1' != (doc + i)->cIndRecGpp || '2' != (doc + i)->cTypRecGpp)\n" \
3019  " {\n" \
3020  " /* pas de réconciliation GPP */\n" \
3021  " continue;\n" \
3022  " }\n" \
3023  "\n" \
3024  " /* Traitement des erreurs SQL */\n" \
3025  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureLiensProfPub\");\n" \
3026  " rIaprof.copyNumNatLoLs((doc + i)->value.inscription[0].val_num, (doc + i)->value.inscription[0].val_lo, (doc + i)->value.inscription[0].val_ls);\n" \
3027  " EXEC SQL\n" \
3028  " OPEN crsLectureLiensProfPub\n" \
3029  " using :rIaprof.acNumnat,\n" \
3030  " :rIaprof.acNumlo,\n" \
3031  " :rIaprof.acNumls;\n" \
3032  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
3033  "\n" \
3034  " if ((int4)GIV::GYBok != iIntRet)\n" \
3035  " {\n" \
3036  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsLectureLiensProfPub: [COD=%d TXT=%s] -%s-\\n\", iIntRet, vErreurSQL.acDonnees_retour, rIaprof.acNumnat));\n" \
3037  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
3038  " }\n" \
3039  "\n" \
3040  " if ((int4)GIV::GYBok == iIntRet)\n" \
3041  " {\n" \
3042  " /* Execution requete de denombrement (FETCH du curseur) */\n" \
3043  " indFinFetch = (int4)GIV::GIXCodeOK;\n" \
3044  "\n" \
3045  " while ((int4)GIV::GIXCodeOK == indFinFetch)\n" \
3046  " {\n" \
3047  " EXEC SQL\n" \
3048  " FETCH crsLectureLiensProfPub\n" \
3049  " INTO\n" \
3050  " :rIaprof.acNumnat,\n" \
3051  " :rIaprof.acNumlo,\n" \
3052  " :rIaprof.acNumls,\n" \
3053  " :rIaprof.acCodan8;\n" \
3054  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
3055  "\n" \
3056  " if ((int4)GIV::GYBok == iIntRet)\n" \
3057  " {\n" \
3058  " /* analyse paru par objet */\n" \
3059  " for (k = 0; k < indice; k++)\n" \
3060  " {\n" \
3061  " if (0 == strcmp(rIaprof.acNumnat, (doc + k)->value.inscription[0].val_num) &&\n" \
3062  " 0 == strcmp(rIaprof.acNumlo, (doc + k)->value.inscription[0].val_lo) &&\n" \
3063  " 0 == strcmp(rIaprof.acNumls, (doc + k)->value.inscription[0].val_ls))\n" \
3064  " break;\n" \
3065  " }\n" \
3066  "\n" \
3067  " if (indice == k)\n" \
3068  " continue;\n" \
3069  "\n" \
3070  " if (MAX_LIST == givrListObj.iNbr)\n" \
3071  " {\n" \
3072  " /* Trop d'entrées internes */\n" \
3073  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
3074  " indFinFetch = (int4)GIV::GIXCodeKO;\n" \
3075  " break;\n" \
3076  " }\n" \
3077  "\n" \
3078  " GWTTrace(GWT_NIV_FONCT, (\"Lien de réconcilication : %d,%s,%s,%s,%d,%s,%s,%s\\n\", i, (doc + i)->value.inscription[0].val_num, (doc + i)->value.inscription[0].val_lo,\n" \
3079  " (doc + i)->value.inscription[0].val_ls, k, rIaprof.acNumnat, rIaprof.acNumlo, rIaprof.acNumls));\n" \
3080  "\n" \
3081  " for (j = 0; j < givrListObj.iNbr; j++)\n" \
3082  " {\n" \
3083  " jj = givrListObj.trEltRangListObj[j];\n" \
3084  "\n" \
3085  " /* Lien Objet-Document par Ligne et par rubrique */\n" \
3086  " if (k == givrListObj.trEltListObj[jj].iRgLigne)\n" \
3087  " {\n" \
3088  " /* ajout objet suivant pour une ligne */\n" \
3089  " givrListObj.trEltListObj[givrListObj.iNbr].iRgLigne = i;\n" \
3090  " givrListObj.trEltListObj[givrListObj.iNbr].iRgObj = (doc + i)->value.objets_pub.nb_micro;\n" \
3091  " givrListObj.trEltListObj[givrListObj.iNbr].iRgLgnRec = k;\n" \
3092  " givrListObj.trEltRangListObj[givrListObj.iNbr] = givrListObj.iNbr;\n" \
3093  " givrListObj.iNbr++;\n" \
3094  " (doc + i)->value.objets_pub.micro[(doc + i)->value.objets_pub.nb_micro] =\n" \
3095  " (doc + k)->value.objets_pub.micro[givrListObj.trEltListObj[jj].iRgObj];\n" \
3096  " (doc + i)->value.objets_pub.nb_micro++;\n" \
3097  " }\n" \
3098  " }\n" \
3099  " }\n" \
3100  " else\n" \
3101  " {\n" \
3102  " /* fin de boucle */\n" \
3103  " indFinFetch = (int4)GIV::GIXCodeKO;\n" \
3104  " }\n" \
3105  " }\n" \
3106  "\n" \
3107  " EXEC SQL\n" \
3108  " close crsLectureLiensProfPub;\n" \
3109  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
3110  "\n" \
3111  " if ((int4)GIV::GYBok != iIntRet)\n" \
3112  " {\n" \
3113  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureLiensProfPub: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
3114  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
3115  " }\n" \
3116  " }\n" \
3117  " }\n" \
3118  "\n" \
3119  " return (iCodRet);\n" \
3120  "}\n" \
3121  "\n" \
3122  "/*----------------------------------Fonction----------------------------------*\n" \
3123  " * Fonction : givInitTriObjGeo\n" \
3124  " *\n" \
3125  " * But : Tri des objets publiciatires\n" \
3126  " *\n" \
3127  " * Description : init du rang d'objet\n" \
3128  " *\n" \
3129  " * Portabilité : sûrement portable\n" \
3130  " *\n" \
3131  " * Interface :\n" \
3132  " *\n" \
3133  " * Paramètres :\n" \
3134  " *\n" \
3135  " * Valeurs retournées :\n" \
3136  " *\n" \
3137  " * Erreurs :\n" \
3138  " *\n" \
3139  " *---------------------------------Historique----------------------------------\n" \
3140  " *\n" \
3141  " * Création : Jan/29/2008 (mb)\n" \
3142  " *\n" \
3143  " * Modification (MMM/JJ/AAAA - xx) :\n" \
3144  " *\n" \
3145  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
3146  "\n" \
3147  "int4 givInitTriObj(GYBrDOCUMENTEpj* doc, int4 indice, int4 iTri)\n" \
3148  "{\n" \
3149  " int4 iCodRet; /* Code retour de la fonction */\n" \
3150  " int4 iIntRet; /* Code retour interne */\n" \
3151  " int4 i, ii, j, k, kk, l, m;\n" \
3152  " int4 iObj, iCVI;\n" \
3153  " int4 iRang, iOrd, iRgLigne, iRgObj;\n" \
3154  " GYBrIamicT rIamic;\n" \
3155  " char tcType[3]; /* type */\n" \
3156  " /* analyse objet par ligne */\n" \
3157  " iCVI = -1;\n" \
3158  " givrListObj.iNbr = 0;\n" \
3159  "\n" \
3160  " /* analyse des CVIV */\n" \
3161  " for (i = 0; i < indice; i++)\n" \
3162  " {\n" \
3163  " for (j = 0; j < (doc + i)->value.objets_pub.nb_micro; j++)\n" \
3164  " {\n" \
3165  " strcpy(tcType, (doc + i)->value.objets_pub.micro[j].stype);\n" \
3166  "\n" \
3167  " for (k = 0; (k < givNbFixeCVI && 0 != strcmp(givTabCVI[k], tcType)); k++)\n" \
3168  " ;\n" \
3169  "\n" \
3170  " if (givNbFixeCVI != k)\n" \
3171  " {\n" \
3172  " iCVI = k;\n" \
3173  " break;\n" \
3174  " }\n" \
3175  " }\n" \
3176  "\n" \
3177  " if ((doc + i)->value.objets_pub.nb_micro != j)\n" \
3178  " break;\n" \
3179  " }\n" \
3180  "\n" \
3181  " for (i = 0; i < indice; i++)\n" \
3182  " {\n" \
3183  " for (j = 0; j < (doc + i)->value.objets_pub.nb_micro; j++)\n" \
3184  " {\n" \
3185  " iObj = givrListObj.iNbr;\n" \
3186  "\n" \
3187  " if (MAX_LIST == iObj)\n" \
3188  " {\n" \
3189  " /* Trop d'entrées internes */\n" \
3190  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
3191  " break;\n" \
3192  " }\n" \
3193  "\n" \
3194  " if ((0 == strcmp(\"RM\", (doc + i)->value.objets_pub.micro[j].stype)) && ((-1 == iCVI) || ((0 != strcmp(\"001\", (doc + i)->value.inscription[0].val_seqLS))\n" \
3195  " && (0 != strlen((doc + i)->value.inscription[0].val_seqLS)))))\n" \
3196  " {\n" \
3197  " /* pas de RM (Ranking Mappy) si CVIV inactif */\n" \
3198  " GWTTrace(GWT_NIV_FONCT, (\"Objet RM avec CVIV absent : %s\\n\", (doc + i)->value.objets_pub.micro[j].id));\n" \
3199  " continue;\n" \
3200  " }\n" \
3201  "\n" \
3202  " givrListObj.trEltRangListObj[iObj] = iObj;\n" \
3203  " givrListObj.trEltListObj[iObj].iRgLigne = i;\n" \
3204  " givrListObj.trEltListObj[iObj].iRgObj = j;\n" \
3205  " givrListObj.trEltListObj[iObj].iRgLgnRec = -1;\n" \
3206  " givrListObj.iNbr++;\n" \
3207  " }\n" \
3208  " }\n" \
3209  "\n" \
3210  " /* description des objets réconciliés au niveau global du bloc epj */\n" \
3211  " iIntRet = givInitTriObjRec(doc, indice, GIV::giv_RUB);\n" \
3212  "\n" \
3213  " if (0 != givrListObj.iNbr)\n" \
3214  " {\n" \
3215  " /* existence d'objet publicitaire */\n" \
3216  " /* trier en fonction des objets */\n" \
3217  " qsort(givrListObj.trEltRangListObj, givrListObj.iNbr, sizeof(int4), givCompListObj);\n" \
3218  " /* analyse liste par objet */\n" \
3219  " iRang = -1;\n" \
3220  " iOrd = 0;\n" \
3221  "\n" \
3222  " for (i = 0; i < givrListObj.iNbr; i++)\n" \
3223  " {\n" \
3224  " k = givrListObj.trEltRangListObj[i];\n" \
3225  " kk = givrListObj.trEltListObj[k].iRgLigne;\n" \
3226  " iObj = givrListObj.trEltListObj[k].iRgObj;\n" \
3227  "\n" \
3228  " if ((0 != strcmp(rIamic.acTypobj, (doc + kk)->value.objets_pub.micro[iObj].type)) || (0 == i) || (0 != strcmp(rIamic.acTpdsob, (doc + kk)->value.objets_pub.micro[iObj].stype))\n" \
3229  " || (0 != strcmp(rIamic.acNumobj, (doc + kk)->value.objets_pub.micro[iObj].id)))\n" \
3230  " {\n" \
3231  " iRang++;\n" \
3232  " iOrd = 0;\n" \
3233  " rIamic.initObjet(doc, kk, iObj);\n" \
3234  " GWTTrace(GWT_NIV_FONCT, (\" Tri objet 1 : ... %d,%d\\n\", iRang, iOrd));\n" \
3235  " }\n" \
3236  " else if ((0 == strcmp(rIamic.acTypobj, (doc + kk)->value.objets_pub.micro[iObj].type)) && (0 == strcmp(rIamic.acTpdsob, (doc + kk)->value.objets_pub.micro[iObj].stype))\n" \
3237  " && (0 != strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"VI\")) && (0 != strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"FI\"))\n" \
3238  " && (0 != strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"IN\")) && (0 != strcmp(rIamic.acStobj, (doc + kk)->value.objets_pub.micro[iObj].sstype))\n" \
3239  " && (0 == strcmp(rIamic.acNumobj, (doc + kk)->value.objets_pub.micro[iObj].id)))\n" \
3240  " {\n" \
3241  " iRang++;\n" \
3242  " iOrd = 0;\n" \
3243  " rIamic.initObjet(doc, kk, iObj);\n" \
3244  " GWTTrace(GWT_NIV_FONCT, (\" Tri objet 2 : ... %d,%d\\n\", iRang, iOrd));\n" \
3245  " }\n" \
3246  " else if ((0 == strcmp(rIamic.acTypobj, (doc + kk)->value.objets_pub.micro[iObj].type)) && (0 == strcmp(rIamic.acTpdsob, (doc + kk)->value.objets_pub.micro[iObj].stype))\n" \
3247  " && ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"VI\")) || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"FI\"))\n" \
3248  " || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"IN\"))) && (0 != strcmp(rIamic.acStobj, (doc + kk)->value.objets_pub.micro[iObj].sstype))\n" \
3249  " && (0 != strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"VS\")) && (0 != strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"VF\"))\n" \
3250  " && (0 != strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"VE\")) && (0 == strcmp(rIamic.acNumobj, (doc + kk)->value.objets_pub.micro[iObj].id)))\n" \
3251  " {\n" \
3252  " iRang++;\n" \
3253  " iOrd = 0;\n" \
3254  " rIamic.initObjet(doc, kk, iObj);\n" \
3255  " GWTTrace(GWT_NIV_FONCT, (\" Tri objet 3 : ... %d,%d\\n\", iRang, iOrd));\n" \
3256  " }\n" \
3257  " else\n" \
3258  " {\n" \
3259  " iOrd++;\n" \
3260  " rIamic.initObjet(doc, kk, iObj);\n" \
3261  " GWTTrace(GWT_NIV_FONCT, (\" Tri objet 4 : ... %d,%d\\n\", iRang, iOrd));\n" \
3262  " }\n" \
3263  "\n" \
3264  " givrListObj.trEltListObj[k].iRangTri = iRang;\n" \
3265  " givrListObj.trEltListObj[k].iOrdTri = iOrd;\n" \
3266  " GWTTrace(GWT_NIV_FONCT, (\" Tri objet : ... %d,%d,%d,%d,%d,%d,%s,%s,%s,%s\\n\", i, k, iRang, iOrd, kk, iObj, (doc + kk)->value.objets_pub.micro[iObj].type, (doc + kk)->value.objets_pub.micro[iObj].stype,\n" \
3267  " (doc + kk)->value.objets_pub.micro[iObj].sstype, (doc + kk)->value.objets_pub.micro[iObj].id));\n" \
3268  " GWTTrace(GWT_NIV_FONCT, (\" Tri objet ref : ... %d,%d,%d,%d,%d,%d,%s,%s,%s,%s\\n\", i, k, iRang, iOrd, kk, iObj, rIamic.acTypobj, rIamic.acTpdsob, rIamic.acStobj, rIamic.acNumobj));\n" \
3269  " }\n" \
3270  "\n" \
3271  " iRang++;\n" \
3272  " givrListObj.iNbrTri = iRang;\n" \
3273  " GWTTrace(GWT_NIV_FONCT, (\" No_objets : ... %d,%d\\n\", givrListObj.iNbrTri, givrListObj.iNbr));\n" \
3274  " }\n" \
3275  "\n" \
3276  " return (iCodRet);\n" \
3277  "}\n" \
3278  "\n" \
3279  "int4 givInitTriObjGeo(GYBrDOCUMENTEpj* doc, int4 indice, int4 iTri)\n" \
3280  "{\n" \
3281  " int4 iCodRet; /* Code retour de la fonction */\n" \
3282  " int4 iIntRet; /* Code retour interne */\n" \
3283  " int4 i, ii, j, k, kk, l, m;\n" \
3284  " int4 iObj, iCVI;\n" \
3285  " int4 iRang, iOrd, iRgLigne, iRgObj;\n" \
3286  " GYBrIamicT rIamic;\n" \
3287  " char tcType[3]; /* type */\n" \
3288  " char* buf_pos;\n" \
3289  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
3290  "\n" \
3291  " if (0 == givrListObj.iNbr)\n" \
3292  " {\n" \
3293  " /* pas d'objet publicitaire */\n" \
3294  " if (GIV::giv_OBJ == iTri)\n" \
3295  " givrListParu.iNbrTri = 0;\n" \
3296  "\n" \
3297  " return (iCodRet);\n" \
3298  " }\n" \
3299  "\n" \
3300  " /* init rangs Paru et Inst à -1 */\n" \
3301  " for (i = 0; i < givrListParu.iNbr; i++)\n" \
3302  " {\n" \
3303  " givrListParu.trEltList[i].iRangTri = -1;\n" \
3304  " givrListParu.trEltList[i].iRgObj = -1;\n" \
3305  " }\n" \
3306  "\n" \
3307  " for (i = 0; i < givrListInst.iNbr; i++)\n" \
3308  " {\n" \
3309  " givrListInst.trEltList[i].iRangTri = -1;\n" \
3310  " givrListInst.trEltList[i].iRgObj = -1;\n" \
3311  " }\n" \
3312  "\n" \
3313  " givrListParu.iNbrTri = 0;\n" \
3314  " l = 0;\n" \
3315  "\n" \
3316  " while (l < givrListObj.iNbr)\n" \
3317  " {\n" \
3318  " k = givrListObj.trEltRangListObj[l];\n" \
3319  " iRang = givrListObj.trEltListObj[k].iRangTri;\n" \
3320  "\n" \
3321  " for (m = l; m < givrListObj.iNbr; m++)\n" \
3322  " {\n" \
3323  " kk = givrListObj.trEltRangListObj[m];\n" \
3324  "\n" \
3325  " if (iRang != givrListObj.trEltListObj[kk].iRangTri)\n" \
3326  " break;\n" \
3327  "\n" \
3328  " /* analyse paru par objet */\n" \
3329  " for (i = 0; i < givrListParu.iNbr; i++)\n" \
3330  " {\n" \
3331  " ii = givrListParu.trEltRangList[i];\n" \
3332  "\n" \
3333  " /* Lien Objet-Document par Ligne */\n" \
3334  " if (givrListObj.trEltListObj[kk].iRgLigne == givrListParu.trEltList[ii].iRgLigne)\n" \
3335  " {\n" \
3336  " if ((-1 == givrListParu.trEltList[ii].iRangTri) && (GIV::giv_OBJ == iTri))\n" \
3337  " {\n" \
3338  " /* premier objet pour une ligne */\n" \
3339  " givrListParu.trEltList[ii].iRangTri = iRang;\n" \
3340  " givrListParu.trEltList[ii].iRgObj = givrListObj.trEltListObj[kk].iRgObj;\n" \
3341  " }\n" \
3342  " else if (GIV::giv_OBJ == iTri)\n" \
3343  " {\n" \
3344  " if (MAX_LIST == givrListParu.iNbrTot)\n" \
3345  " {\n" \
3346  " /* Trop d'entrées internes */\n" \
3347  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne Paru dépassée: %s,%d,%d\\n\", doc->value.a_classer.etab, givrListObj.iNbr, givrListObj.iNbrTri));\n" \
3348  " break;\n" \
3349  " }\n" \
3350  "\n" \
3351  " /* ajout objet suivant pour une ligne */\n" \
3352  " givrListParu.trEltList[givrListParu.iNbrTot] = givrListParu.trEltList[ii];\n" \
3353  " givrListParu.trEltList[givrListParu.iNbrTot].iRangTri = iRang;\n" \
3354  " givrListParu.trEltList[givrListParu.iNbrTot].iRgObj = givrListObj.trEltListObj[kk].iRgObj;\n" \
3355  " givrListParu.trEltList[givrListParu.iNbrTot].iRgDnom = -1;\n" \
3356  " givrListParu.trEltRangList[givrListParu.iNbrTot] = givrListParu.iNbrTot;\n" \
3357  " givrListParu.iNbrTot++;\n" \
3358  " }\n" \
3359  " else\n" \
3360  " {\n" \
3361  " /* Rang de tri d'objet dans document d'une ligne */\n" \
3362  " iRgLigne = givrListObj.trEltListObj[kk].iRgLigne;\n" \
3363  " iRgObj = givrListObj.trEltListObj[kk].iRgObj;\n" \
3364  " (doc + iRgLigne)->value.objets_pub.micro[iRgObj].iRgObj = iRang;\n" \
3365  " sprintf((doc + iRgLigne)->value.objets_pub.micro[iRgObj].tcRgObj, \"%04d\", iRang);\n" \
3366  " }\n" \
3367  " }\n" \
3368  " }\n" \
3369  "\n" \
3370  " /* analyse inst par objet */\n" \
3371  " for (i = 0; i < givrListInst.iNbr; i++)\n" \
3372  " {\n" \
3373  " ii = givrListInst.trEltRangList[i];\n" \
3374  "\n" \
3375  " if (givrListObj.trEltListObj[kk].iRgLigne == givrListInst.trEltList[ii].iRgLigne)\n" \
3376  " {\n" \
3377  " if ((-1 == givrListInst.trEltList[ii].iRangTri) && (GIV::giv_OBJ == iTri))\n" \
3378  " {\n" \
3379  " /* premier objet pour une ligne */\n" \
3380  " givrListInst.trEltList[ii].iRangTri = iRang;\n" \
3381  " givrListInst.trEltList[ii].iRgObj = givrListObj.trEltListObj[kk].iRgObj;\n" \
3382  " }\n" \
3383  " else if (GIV::giv_OBJ == iTri)\n" \
3384  " {\n" \
3385  " if (MAX_LIST == givrListInst.iNbrTot)\n" \
3386  " {\n" \
3387  " /* Trop d'entrées internes */\n" \
3388  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne Inst dépassée: %s,%d,%d\\n\", doc->value.a_classer.etab, givrListObj.iNbr, givrListObj.iNbrTri));\n" \
3389  " break;\n" \
3390  " }\n" \
3391  "\n" \
3392  " /* ajout objet suivant pour une ligne */\n" \
3393  " givrListInst.trEltList[givrListInst.iNbrTot] = givrListInst.trEltList[ii];\n" \
3394  " givrListInst.trEltList[givrListInst.iNbrTot].iRangTri = iRang;\n" \
3395  " givrListInst.trEltList[givrListInst.iNbrTot].iRgObj = givrListObj.trEltListObj[kk].iRgObj;\n" \
3396  " givrListInst.trEltRangList[givrListInst.iNbrTot] = givrListInst.iNbrTot;\n" \
3397  " givrListInst.iNbrTot++;\n" \
3398  " }\n" \
3399  " }\n" \
3400  " }\n" \
3401  " }\n" \
3402  "\n" \
3403  " /* nombre d'objets */\n" \
3404  " if (GIV::giv_OBJ == iTri)\n" \
3405  " {\n" \
3406  " if (MAX_LIST == givrListParu.iNbrTot)\n" \
3407  " {\n" \
3408  " /* Trop d'entrées internes */\n" \
3409  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
3410  " }\n" \
3411  " else\n" \
3412  " givrListParu.iNbrTri++;\n" \
3413  " }\n" \
3414  "\n" \
3415  " l = m;\n" \
3416  " }\n" \
3417  "\n" \
3418  " givrListParu.iNbr = givrListParu.iNbrTot;\n" \
3419  " givrListInst.iNbr = givrListInst.iNbrTot;\n" \
3420  " return (iCodRet);\n" \
3421  "}\n" \
3422  "\n" \
3423  "/*----------------------------------Fonction----------------------------------*\n" \
3424  " * Fonction : givTriZU\n" \
3425  " *\n" \
3426  " * But : Tri des codes géographiques sur ZU\n" \
3427  " *\n" \
3428  " * Description :\n" \
3429  " * Fonction de tri des réponses en fonction d'un critère qui précise l'ordre\n" \
3430  " * de priorité des tris\n" \
3431  " *\n" \
3432  " * Portabilité : sûrement portable\n" \
3433  " *\n" \
3434  " * Interface :\n" \
3435  " *\n" \
3436  " * Paramètres :\n" \
3437  " *\n" \
3438  " * Valeurs retournées :\n" \
3439  " *\n" \
3440  " * Erreurs :\n" \
3441  " *\n" \
3442  " *---------------------------------Historique----------------------------------\n" \
3443  " *\n" \
3444  " * Création : Jun/14/2013 (mb)\n" \
3445  " *\n" \
3446  " * Modification (MMM/JJ/AAAA - xx) :\n" \
3447  " *\n" \
3448  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
3449  "\n" \
3450  "int4 givTriZU(void)\n" \
3451  "{\n" \
3452  " int4 iCodRet; /* Code retour de la fonction */\n" \
3453  " char tcDeplocarr[GYBIeinscLgDeppar + GYBIeinscLgLocpar + GYBIeinscLgArrond + 1];\n" \
3454  " int4 iRgLigne, iRefLigne, iLF, iGeo;\n" \
3455  " int4 i, j, k, l;\n" \
3456  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
3457  " iGeo = givrListParu.iNbr;\n" \
3458  "\n" \
3459  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
3460  " {\n" \
3461  " i = givrListParu.trEltRangList[j];\n" \
3462  "\n" \
3463  " if (0 == strcmp(givrListParu.trEltList[i].loc, givcLocFictive))\n" \
3464  " {\n" \
3465  " for (l = 0; l < j; l++)\n" \
3466  " {\n" \
3467  " k = givrListParu.trEltRangList[l];\n" \
3468  "\n" \
3469  " if ((0 == strcmp(givrListParu.trEltList[k].loc, givcLocFictive)) && (0 == strcmp(givrListParu.trEltList[i].dep, givrListParu.trEltList[k].dep)))\n" \
3470  " {\n" \
3471  " /* dep LF déjà traité */\n" \
3472  " break;\n" \
3473  " }\n" \
3474  " }\n" \
3475  " }\n" \
3476  "\n" \
3477  " if ((0 == strcmp(givrListParu.trEltList[i].loc, givcLocFictive)) && (l == j))\n" \
3478  " {\n" \
3479  " iRgLigne = -1;\n" \
3480  " iRefLigne = givrListParu.trEltList[i].iRgLigne;\n" \
3481  " strcpy(tcDeplocarr, givrListParu.trEltList[i].dep);\n" \
3482  " GWTTrace(GWT_NIV_FONCT, (\"ZU LF [%d],[%d],[%s],[%s]\\n\", givrListParu.trEltList[i].iRgLigne, givrListParu.trEltList[i].iZU, givrListParu.trEltList[i].dep, givrListParu.trEltList[i].loc));\n" \
3483  "\n" \
3484  " for (l = 0; l < (givrListParu.iNbr); l++)\n" \
3485  " {\n" \
3486  " k = givrListParu.trEltRangList[l];\n" \
3487  " GWTTrace(GWT_NIV_FONCT, (\"ZU LF Ins [%d],[%d],[%d],[%d],[%d],[%s],[%s]\\n\", iRefLigne, iRgLigne, iLF, givrListParu.trEltList[k].iRgLigne, givrListParu.trEltList[k].iZU, givrListParu.trEltList[k].dep,\n" \
3488  " givrListParu.trEltList[k].loc));\n" \
3489  "\n" \
3490  " if (iRefLigne == givrListParu.trEltList[k].iRgLigne)\n" \
3491  " continue;\n" \
3492  " else if (iRgLigne != givrListParu.trEltList[k].iRgLigne)\n" \
3493  " {\n" \
3494  " /* changement de ligne */\n" \
3495  " iRgLigne = givrListParu.trEltList[k].iRgLigne;\n" \
3496  " iLF = GIV::GIXCodeKO;\n" \
3497  "\n" \
3498  " if (0 == strcmp(givrListParu.trEltList[k].loc, givcLocFictive))\n" \
3499  " {\n" \
3500  " /* localité fictive à ne pas traiter */\n" \
3501  " iLF = GIV::GIXCodeOK;\n" \
3502  " }\n" \
3503  " }\n" \
3504  " else if (GIV::GIXCodeOK == iLF)\n" \
3505  " {\n" \
3506  " /* même ligne avec LF ne pas traiter */\n" \
3507  " }\n" \
3508  " else if (((int4)GIV::GIXCodeOK == givrListParu.trEltList[k].iZU) && (0 == strcmp(tcDeplocarr, givrListParu.trEltList[k].dep)))\n" \
3509  " {\n" \
3510  " /* même ligne avec ZU et dep de LF */\n" \
3511  " /* implicitement parution sur le pôle */\n" \
3512  " GWTTrace(GWT_NIV_FONCT, (\"Ajout ZU LF Ins [%d],[%d]\\n\", iGeo, MAX_LIST));\n" \
3513  "\n" \
3514  " if (MAX_LIST == iGeo)\n" \
3515  " {\n" \
3516  " /* Trop d'entrées internes */\n" \
3517  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
3518  " break;\n" \
3519  " }\n" \
3520  "\n" \
3521  " (void)strcpy(givrListParu.trEltList[iGeo].rub, givrListParu.trEltList[k].rub);\n" \
3522  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, givrListParu.trEltList[k].rubinit);\n" \
3523  " (void)strcpy(givrListParu.trEltList[iGeo].nature, givrListParu.trEltList[k].nature);\n" \
3524  " givrListParu.trEltList[iGeo].orig = givrListParu.trEltList[k].orig;\n" \
3525  " givrListParu.trEltList[iGeo].cParuloc = givrListParu.trEltList[k].cParuloc;\n" \
3526  " (void)strcpy(givrListParu.trEltList[iGeo].dep, givrListParu.trEltList[k].dep);\n" \
3527  " (void)strcpy(givrListParu.trEltList[iGeo].loc, givrListParu.trEltList[k].loc);\n" \
3528  " (void)strcpy(givrListParu.trEltList[iGeo].arr, \"00\");\n" \
3529  " (void)strcpy(givrListParu.trEltList[iGeo].reg, givrListParu.trEltList[k].reg);\n" \
3530  " givrListParu.trEltList[iGeo].iDbl = -1;\n" \
3531  " givrListParu.trEltList[iGeo].iRgLigne = givrListParu.trEltList[k].iRgLigne;\n" \
3532  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
3533  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
3534  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
3535  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
3536  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
3537  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
3538  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeKO;\n" \
3539  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
3540  " iGeo++;\n" \
3541  " }\n" \
3542  " }\n" \
3543  " }\n" \
3544  " }\n" \
3545  "\n" \
3546  " givrListParu.iNbr = iGeo;\n" \
3547  " return (iCodRet);\n" \
3548  "}\n" \
3549  "\n" \
3550  "/*----------------------------------Fonction----------------------------------*\n" \
3551  " * Fonction : givTriGeo\n" \
3552  " *\n" \
3553  " * But : Tri des codes géographiques\n" \
3554  " *\n" \
3555  " * Description :\n" \
3556  " * Fonction de tri des réponses en fonction d'un critère qui précise l'ordre\n" \
3557  " * de priorité des tris\n" \
3558  " *\n" \
3559  " * Portabilité : sûrement portable\n" \
3560  " *\n" \
3561  " * Interface :\n" \
3562  " *\n" \
3563  " * Paramètres :\n" \
3564  " *\n" \
3565  " * Valeurs retournées :\n" \
3566  " *\n" \
3567  " * Erreurs :\n" \
3568  " *\n" \
3569  " *---------------------------------Historique----------------------------------\n" \
3570  " *\n" \
3571  " * Création : Jan/29/2008 (mb)\n" \
3572  " *\n" \
3573  " * Modification (MMM/JJ/AAAA - xx) :\n" \
3574  " *\n" \
3575  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
3576  "\n" \
3577  "int4 givTriGeo(GYBrDOCUMENTEpj* doc, int4 indice, int4 iTri)\n" \
3578  "{\n" \
3579  " int4 iCodRet; /* Code retour de la fonction */\n" \
3580  " int4 iIntRet; /* Code retour interne */\n" \
3581  " int4 iFinInst;\n" \
3582  " int4 iFinParu;\n" \
3583  " int4 iDblRegInst;\n" \
3584  " int4 iDblDeptInst;\n" \
3585  " int4 iDblLocInst;\n" \
3586  " int4 iDblArrInst;\n" \
3587  " int4 iDblRegParu;\n" \
3588  " int4 iDblDeptParu;\n" \
3589  " int4 iDblLocParu;\n" \
3590  " int4 iDblArrParu;\n" \
3591  " int4 iDblZU;\n" \
3592  " int4 iGeoParu, iGeoInst;\n" \
3593  " int4 iGeoArr, iGeoArrInst, iGeoLoc, iGeoDept, iGeoReg;\n" \
3594  " int4 i, j, k, l, m, n;\n" \
3595  " int4 ii, jj, kk, ll;\n" \
3596  " int4 iIndCar;\n" \
3597  " int4 iVal;\n" \
3598  " int4 iRangRub, iRgRubDbl, iNbGeoRub, iRgGeoRub, iRangDeb, iNbrRub;\n" \
3599  " iFinInst = (int4)GIV::GIXCodeKO;\n" \
3600  " iFinParu = (int4)GIV::GIXCodeKO;\n" \
3601  " /* Initialisation des variables locales */\n" \
3602  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
3603  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
3604  " /* doubles */\n" \
3605  " iDblRegInst = (int4)GIV::GIXCodeKO;\n" \
3606  " iDblDeptInst = (int4)GIV::GIXCodeKO;\n" \
3607  " iDblLocInst = (int4)GIV::GIXCodeKO;\n" \
3608  " iDblArrInst = (int4)GIV::GIXCodeKO;\n" \
3609  " iDblRegParu = (int4)GIV::GIXCodeKO;\n" \
3610  " iDblDeptParu = (int4)GIV::GIXCodeKO;\n" \
3611  " iDblLocParu = (int4)GIV::GIXCodeKO;\n" \
3612  " iDblArrParu = (int4)GIV::GIXCodeKO;\n" \
3613  " iDblZU = (int4)GIV::GIXCodeKO;\n" \
3614  "\n" \
3615  " if (0 == givrListParu.iNbr)\n" \
3616  " {\n" \
3617  " /* pas de possibilité d'arrondissement d'installation local */\n" \
3618  " /* Retourner sans erreur */\n" \
3619  " return (iCodRet);\n" \
3620  " }\n" \
3621  "\n" \
3622  " /* trier en fonction des codes de parution */\n" \
3623  " qsort(givrListParu.trEltRangList, givrListParu.iNbr, sizeof(int4), givCompListParu);\n" \
3624  " GWTTrace(GWT_NIV_FONCT, (\"givTriGeo 1 \\n\"));\n" \
3625  "\n" \
3626  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
3627  " {\n" \
3628  " i = givrListParu.trEltRangList[j];\n" \
3629  " GWTTrace(GWT_NIV_FONCT, (\"Parution [%d],[%d],[%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d],[%d]\\n\", givrListParu.trEltList[i].iRangTri, givrListParu.trEltList[i].iRgLigne,\n" \
3630  " givrListParu.trEltList[i].iRgObj, givrListParu.trEltList[i].rub, givrListParu.trEltList[i].dep, givrListParu.trEltList[i].loc, givrListParu.trEltList[i].arr, givrListParu.trEltList[i].reg,\n" \
3631  " givrListParu.trEltList[i].iGeoReg, givrListParu.trEltList[i].iGeoDept, givrListParu.trEltList[i].iGeoLoc, givrListParu.trEltList[i].iGeoArr, givrListParu.trEltList[i].iZU));\n" \
3632  " }\n" \
3633  "\n" \
3634  " /* suppression des objets hors tri */\n" \
3635  " for (i = 0; i < givrListParu.iNbr; i++)\n" \
3636  " {\n" \
3637  " j = givrListParu.trEltRangList[i];\n" \
3638  "\n" \
3639  " if (-1 == givrListParu.trEltList[j].iRangTri)\n" \
3640  " break;\n" \
3641  " }\n" \
3642  "\n" \
3643  " givrListParu.iNbr = i;\n" \
3644  "\n" \
3645  " if (0 == givrListParu.iNbr)\n" \
3646  " {\n" \
3647  " /* Retourner sans erreur */\n" \
3648  " return (iCodRet);\n" \
3649  " }\n" \
3650  "\n" \
3651  " /* trier en fonction des codes d'installation */\n" \
3652  " qsort(givrListInst.trEltRangList, givrListInst.iNbr, sizeof(int4), givCompListInst);\n" \
3653  "\n" \
3654  " for (j = 0; j < (givrListInst.iNbr); j++)\n" \
3655  " {\n" \
3656  " i = givrListInst.trEltRangList[j];\n" \
3657  " GWTTrace(GWT_NIV_FONCT, (\"Installation [%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d]\\n\", givrListInst.trEltList[i].iRangTri, givrListInst.trEltList[i].rub, givrListInst.trEltList[i].dep,\n" \
3658  " givrListInst.trEltList[i].loc, givrListInst.trEltList[i].arr, givrListInst.trEltList[i].reg, givrListInst.trEltList[i].iGeoReg, givrListInst.trEltList[i].iGeoDept, givrListInst.trEltList[i].iGeoLoc,\n" \
3659  " givrListInst.trEltList[i].iGeoArr));\n" \
3660  " }\n" \
3661  "\n" \
3662  " /* supression objets hors tri */\n" \
3663  " for (i = 0; i < givrListInst.iNbr; i++)\n" \
3664  " {\n" \
3665  " j = givrListInst.trEltRangList[i];\n" \
3666  "\n" \
3667  " if (-1 == givrListInst.trEltList[j].iRangTri)\n" \
3668  " break;\n" \
3669  " }\n" \
3670  "\n" \
3671  " givrListInst.iNbr = i;\n" \
3672  " /* analyse de codes Locaux ou Extra-Locaux */\n" \
3673  " i = 0;\n" \
3674  " j = 0;\n" \
3675  " k = givrListParu.trEltRangList[i];\n" \
3676  " l = givrListInst.trEltRangList[j];\n" \
3677  " kk = -1;\n" \
3678  " ll = -1;\n" \
3679  "\n" \
3680  " while (((int4)GIV::GIXCodeKO == iFinInst) || ((int4)GIV::GIXCodeKO == iFinParu))\n" \
3681  " {\n" \
3682  " /* analyse changement de parution */\n" \
3683  " iDblRegParu = (int4)GIV::GIXCodeKO;\n" \
3684  " iDblDeptParu = (int4)GIV::GIXCodeKO;\n" \
3685  " iDblLocParu = (int4)GIV::GIXCodeKO;\n" \
3686  " iDblArrParu = (int4)GIV::GIXCodeKO;\n" \
3687  "\n" \
3688  " if (kk != k)\n" \
3689  " {\n" \
3690  " if ((0 != strcmp(givrListParu.trEltList[kk].reg, givrListParu.trEltList[k].reg)) || (0 == i) || (givrListParu.trEltList[kk].iRangTri != givrListParu.trEltList[k].iRangTri))\n" \
3691  " {\n" \
3692  " /* changement de reg */\n" \
3693  " iDblRegParu = (int4)GIV::GIXCodeOK;\n" \
3694  " iDblDeptParu = (int4)GIV::GIXCodeOK;\n" \
3695  " iDblLocParu = (int4)GIV::GIXCodeOK;\n" \
3696  " iDblArrParu = (int4)GIV::GIXCodeOK;\n" \
3697  " }\n" \
3698  " else if (0 != strcmp(givrListParu.trEltList[kk].dep, givrListParu.trEltList[k].dep))\n" \
3699  " {\n" \
3700  " /* changement de dept */\n" \
3701  " iDblDeptParu = (int4)GIV::GIXCodeOK;\n" \
3702  " iDblLocParu = (int4)GIV::GIXCodeOK;\n" \
3703  " iDblArrParu = (int4)GIV::GIXCodeOK;\n" \
3704  " }\n" \
3705  " else if (0 != strcmp(givrListParu.trEltList[kk].loc, givrListParu.trEltList[k].loc))\n" \
3706  " {\n" \
3707  " /* changement de loc */\n" \
3708  " iDblLocParu = (int4)GIV::GIXCodeOK;\n" \
3709  " iDblArrParu = (int4)GIV::GIXCodeOK;\n" \
3710  " }\n" \
3711  " else if (0 != strcmp(givrListParu.trEltList[kk].arr, givrListParu.trEltList[k].arr))\n" \
3712  " {\n" \
3713  " /* changement d'arr */\n" \
3714  " iDblArrParu = (int4)GIV::GIXCodeOK;\n" \
3715  " }\n" \
3716  " }\n" \
3717  "\n" \
3718  " /* analyse changement d'installation */\n" \
3719  " iDblRegInst = (int4)GIV::GIXCodeKO;\n" \
3720  " iDblDeptInst = (int4)GIV::GIXCodeKO;\n" \
3721  " iDblLocInst = (int4)GIV::GIXCodeKO;\n" \
3722  " iDblArrInst = (int4)GIV::GIXCodeKO;\n" \
3723  "\n" \
3724  " if (ll != l)\n" \
3725  " {\n" \
3726  " if ((0 != strcmp(givrListInst.trEltList[ll].reg, givrListInst.trEltList[l].reg)) || (0 == j) || (givrListInst.trEltList[ll].iRangTri != givrListInst.trEltList[l].iRangTri))\n" \
3727  " iDblArrInst = (int4)GIV::GIXCodeOK;\n" \
3728  " else if (0 != strcmp(givrListInst.trEltList[ll].dep, givrListInst.trEltList[l].dep))\n" \
3729  " iDblArrInst = (int4)GIV::GIXCodeOK;\n" \
3730  " else if (0 != strcmp(givrListInst.trEltList[ll].loc, givrListInst.trEltList[l].loc))\n" \
3731  " iDblArrInst = (int4)GIV::GIXCodeOK;\n" \
3732  " else if (0 != strcmp(givrListInst.trEltList[ll].arr, givrListInst.trEltList[l].arr))\n" \
3733  " iDblArrInst = (int4)GIV::GIXCodeOK;\n" \
3734  " }\n" \
3735  "\n" \
3736  " /* comparaison Parution/Installation */\n" \
3737  " kk = k;\n" \
3738  " ll = l;\n" \
3739  " iGeoReg = 99;\n" \
3740  " iGeoDept = 99;\n" \
3741  " iGeoLoc = 99;\n" \
3742  " iGeoArr = 99;\n" \
3743  " iGeoArrInst = GIV::giv_INIT_ARR;\n" \
3744  "\n" \
3745  " if ((0 == strcmp(givrListParu.trEltList[k].reg, givrListInst.trEltList[l].reg)) && (givrListParu.trEltList[k].iRangTri == givrListInst.trEltList[l].iRangTri))\n" \
3746  " {\n" \
3747  " /* même région */\n" \
3748  " if (0 == strcmp(givrListParu.trEltList[k].dep, givrListInst.trEltList[l].dep))\n" \
3749  " {\n" \
3750  " iGeoDept = GIV::giv_LOC;\n" \
3751  " iGeoReg = GIV::giv_LOC;\n" \
3752  "\n" \
3753  " if (0 == strcmp(givrListParu.trEltList[k].loc, givrListInst.trEltList[l].loc))\n" \
3754  " {\n" \
3755  " /* inscription locale */\n" \
3756  " iGeoLoc = GIV::giv_LOC;\n" \
3757  "\n" \
3758  " /* inscription locale : arr */\n" \
3759  " if ((0 != strcmp(\"99\", givrListInst.trEltList[l].arr)) && ((int4)GIV::GIXCodeOK != givrListParu.trEltList[k].iZU))\n" \
3760  " iGeoArrInst = GIV::giv_ARR;\n" \
3761  "\n" \
3762  " if ((0 == strcmp(givrListInst.trEltList[l].arr, givrListParu.trEltList[k].arr)) && ((int4)GIV::GIXCodeKO == iFinParu))\n" \
3763  " {\n" \
3764  " /* même arrondissement */\n" \
3765  " /* inscription locale : arr */\n" \
3766  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
3767  " iGeoArr = GIV::giv_ARR;\n" \
3768  "\n" \
3769  " /* arr paru suivant */\n" \
3770  " i++;\n" \
3771  " }\n" \
3772  " else if (((0 < strcmp(givrListInst.trEltList[l].arr, givrListParu.trEltList[k].arr)) && ((int4)GIV::GIXCodeKO == iFinParu)) || ((int4)GIV::GIXCodeOK == iFinInst))\n" \
3773  " {\n" \
3774  " /* arr inst > arr paru */\n" \
3775  " /* différents arrondissements */\n" \
3776  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
3777  " iGeoArr = GIV::giv_EXTL;\n" \
3778  "\n" \
3779  " /* inscription locale : arr extra */\n" \
3780  " /* arr paru suivant */\n" \
3781  " i++;\n" \
3782  " }\n" \
3783  " else if ((0 > strcmp(givrListInst.trEltList[l].arr, givrListParu.trEltList[k].arr)) || ((int4)GIV::GIXCodeOK == iFinParu))\n" \
3784  " {\n" \
3785  " /* arr inst < arr paru */\n" \
3786  " /* différents arrondissements */\n" \
3787  " /* inscription locale : arr */\n" \
3788  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
3789  " iGeoArr = GIV::giv_EXTL;\n" \
3790  "\n" \
3791  " /* arr inst suivant */\n" \
3792  " j++;\n" \
3793  " }\n" \
3794  " }\n" \
3795  " else if (((0 > strcmp(givrListParu.trEltList[k].loc, givrListInst.trEltList[l].loc)) && ((int4)GIV::GIXCodeKO == iFinParu)) || ((int4)GIV::GIXCodeOK == iFinInst))\n" \
3796  " {\n" \
3797  " /* inscription départementale */\n" \
3798  " /* loc inst > loc paru */\n" \
3799  " /* différentes localités */\n" \
3800  " iGeoLoc = GIV::giv_EXTL;\n" \
3801  "\n" \
3802  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
3803  " iGeoArr = GIV::giv_EXTL;\n" \
3804  "\n" \
3805  " /* inscription dept : loc extra */\n" \
3806  " /* loc paru suivante */\n" \
3807  " i++;\n" \
3808  " }\n" \
3809  " else if ((0 < strcmp(givrListParu.trEltList[k].loc, givrListInst.trEltList[l].loc)) || ((int4)GIV::GIXCodeOK == iFinParu))\n" \
3810  " {\n" \
3811  " /* inscription départementale */\n" \
3812  " /* loc inst < loc paru */\n" \
3813  " iGeoLoc = GIV::giv_EXTL;\n" \
3814  "\n" \
3815  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
3816  " iGeoArr = GIV::giv_EXTL;\n" \
3817  "\n" \
3818  " /* loc inst suivante */\n" \
3819  " j++;\n" \
3820  " }\n" \
3821  " }\n" \
3822  " else\n" \
3823  " {\n" \
3824  " /* inscription extra départementale */\n" \
3825  " iGeoDept = GIV::giv_EXTL;\n" \
3826  " iGeoLoc = GIV::giv_EXTL;\n" \
3827  "\n" \
3828  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
3829  " iGeoArr = GIV::giv_EXTL;\n" \
3830  "\n" \
3831  " /* inscription régionale */\n" \
3832  " iGeoReg = GIV::giv_LOC;\n" \
3833  "\n" \
3834  " if (((0 > strcmp(givrListParu.trEltList[k].dep, givrListInst.trEltList[l].dep)) && ((int4)GIV::GIXCodeKO == iFinParu)) || ((int4)GIV::GIXCodeOK == iFinInst))\n" \
3835  " {\n" \
3836  " /* dept inst > dept paru */\n" \
3837  " /* différents départements */\n" \
3838  " /* inscription extra dept : dep extra */\n" \
3839  " /* dept paru suivant */\n" \
3840  " i++;\n" \
3841  " }\n" \
3842  " else if ((0 < strcmp(givrListParu.trEltList[k].dep, givrListInst.trEltList[l].dep)) || ((int4)GIV::GIXCodeOK == iFinParu))\n" \
3843  " {\n" \
3844  " /* dept inst < dept paru */\n" \
3845  " /* dept inst suivant */\n" \
3846  " j++;\n" \
3847  " }\n" \
3848  " }\n" \
3849  " }\n" \
3850  " else if (givrListParu.trEltList[k].iRangTri == givrListInst.trEltList[l].iRangTri)\n" \
3851  " {\n" \
3852  " /* différentes régions */\n" \
3853  " /* inscription extra départementale */\n" \
3854  " iGeoDept = GIV::giv_EXTL;\n" \
3855  " iGeoLoc = GIV::giv_EXTL;\n" \
3856  "\n" \
3857  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
3858  " iGeoArr = GIV::giv_EXTL;\n" \
3859  "\n" \
3860  " /* inscription extra-régionale */\n" \
3861  " iGeoReg = GIV::giv_EXTL;\n" \
3862  "\n" \
3863  " if (((0 > strcmp(givrListParu.trEltList[k].reg, givrListInst.trEltList[l].reg)) && ((int4)GIV::GIXCodeKO == iFinParu)) || ((int4)GIV::GIXCodeOK == iFinInst))\n" \
3864  " {\n" \
3865  " /* reg inst > reg paru */\n" \
3866  " /* différents départements */\n" \
3867  " /* inscription extra dept : dep extra */\n" \
3868  " /* dept paru suivant */\n" \
3869  " i++;\n" \
3870  " }\n" \
3871  " else if ((0 < strcmp(givrListParu.trEltList[k].reg, givrListInst.trEltList[l].reg)) || ((int4)GIV::GIXCodeOK == iFinParu))\n" \
3872  " {\n" \
3873  " /* reg inst < reg paru */\n" \
3874  " /* dept inst suivant */\n" \
3875  " j++;\n" \
3876  " }\n" \
3877  " }\n" \
3878  " else\n" \
3879  " {\n" \
3880  " /* différentes rubriques */\n" \
3881  " /* inscription extra départementale */\n" \
3882  " iGeoDept = GIV::giv_EXTL;\n" \
3883  " iGeoLoc = GIV::giv_EXTL;\n" \
3884  "\n" \
3885  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
3886  " iGeoArr = GIV::giv_EXTL;\n" \
3887  "\n" \
3888  " /* inscription extra-régionale */\n" \
3889  " iGeoReg = GIV::giv_EXTL;\n" \
3890  "\n" \
3891  " if (((givrListParu.trEltList[k].iRangTri < givrListInst.trEltList[l].iRangTri) && ((int4)GIV::GIXCodeKO == iFinParu)) || ((int4)GIV::GIXCodeOK == iFinInst))\n" \
3892  " {\n" \
3893  " /* rub inst > rub paru */\n" \
3894  " /* rub paru suivante */\n" \
3895  " i++;\n" \
3896  " }\n" \
3897  " else if ((givrListParu.trEltList[k].iRangTri > givrListInst.trEltList[l].iRangTri) || ((int4)GIV::GIXCodeOK == iFinParu))\n" \
3898  " {\n" \
3899  " /* rub inst < rub paru */\n" \
3900  " /* rub inst suivante */\n" \
3901  " j++;\n" \
3902  " }\n" \
3903  " }\n" \
3904  "\n" \
3905  " /* pas d'arrondissement pour le pôle de zone urbaine */\n" \
3906  " if (0 == strcmp(\"00\", givrListParu.trEltList[k].arr))\n" \
3907  " iGeoArr = 99;\n" \
3908  "\n" \
3909  " if (0 == strcmp(\"999\", givrListParu.trEltList[k].dep))\n" \
3910  " {\n" \
3911  " /* ancienne région : seule la parution sur région est validée */\n" \
3912  " iGeoDept = 99;\n" \
3913  " iGeoLoc = 99;\n" \
3914  " iGeoArr = 99;\n" \
3915  " iGeoArrInst = GIV::giv_INIT_ARR;\n" \
3916  " }\n" \
3917  "\n" \
3918  " GWTTrace(GWT_NIV_FONCT, (\"Parution [%d],[%d],[%d],[%d]\\n\", givrListParu.iNbr, i, givrListInst.iNbr, j));\n" \
3919  "\n" \
3920  " /* Analyse meilleur iGeo */\n" \
3921  " if ((99 != givrListParu.trEltList[k].iGeoReg) && (iGeoReg < givrListParu.trEltList[k].iGeoReg))\n" \
3922  " iDblRegParu = (int4)GIV::GIXCodeOK;\n" \
3923  "\n" \
3924  " if ((99 != givrListParu.trEltList[k].iGeoDept) && (iGeoDept < givrListParu.trEltList[k].iGeoDept))\n" \
3925  " iDblDeptParu = (int4)GIV::GIXCodeOK;\n" \
3926  "\n" \
3927  " if ((99 != givrListParu.trEltList[k].iGeoLoc) && (iGeoLoc < givrListParu.trEltList[k].iGeoLoc))\n" \
3928  " iDblLocParu = (int4)GIV::GIXCodeOK;\n" \
3929  "\n" \
3930  " if ((99 != givrListParu.trEltList[k].iGeoArr) && (iGeoArr < givrListParu.trEltList[k].iGeoArr))\n" \
3931  " iDblArrParu = (int4)GIV::GIXCodeOK;\n" \
3932  "\n" \
3933  " if ((99 != givrListInst.trEltList[l].iGeoArr) && (iGeoArrInst < givrListInst.trEltList[l].iGeoArr))\n" \
3934  " iDblArrInst = (int4)GIV::GIXCodeOK;\n" \
3935  "\n" \
3936  " /* Validation iGeo */\n" \
3937  " if ((int4)GIV::GIXCodeOK == iDblRegParu)\n" \
3938  " {\n" \
3939  " /* changement de reg */\n" \
3940  " givrListParu.trEltList[k].iGeoReg = iGeoReg;\n" \
3941  " }\n" \
3942  "\n" \
3943  " if ((int4)GIV::GIXCodeOK == iDblDeptParu)\n" \
3944  " {\n" \
3945  " /* changement de dept */\n" \
3946  " givrListParu.trEltList[k].iGeoDept = iGeoDept;\n" \
3947  " }\n" \
3948  "\n" \
3949  " if ((int4)GIV::GIXCodeOK == iDblLocParu)\n" \
3950  " {\n" \
3951  " /* changement de loc */\n" \
3952  " givrListParu.trEltList[k].iGeoLoc = iGeoLoc;\n" \
3953  " }\n" \
3954  "\n" \
3955  " if (((int4)GIV::GIXCodeOK == iDblArrParu) && (0 != strcmp(\"99\", givrListParu.trEltList[k].arr)))\n" \
3956  " {\n" \
3957  " /* changement d'arr */\n" \
3958  " givrListParu.trEltList[k].iGeoArr = iGeoArr;\n" \
3959  " }\n" \
3960  "\n" \
3961  " if ((int4)GIV::GIXCodeOK == iDblArrInst)\n" \
3962  " {\n" \
3963  " /* changement d'arr instal */\n" \
3964  " givrListInst.trEltList[l].iGeoArr = iGeoArrInst;\n" \
3965  " }\n" \
3966  "\n" \
3967  " if ((i < givrListParu.iNbr) && (j == givrListInst.iNbr) && (j != 0))\n" \
3968  " {\n" \
3969  " /* fin de liste installation */\n" \
3970  " j--;\n" \
3971  " iFinInst = (int4)GIV::GIXCodeOK;\n" \
3972  " }\n" \
3973  " else if ((i == givrListParu.iNbr) && (j < givrListInst.iNbr) && (i != 0))\n" \
3974  " {\n" \
3975  " /* fin de liste parution */\n" \
3976  " i--;\n" \
3977  " iFinParu = (int4)GIV::GIXCodeOK;\n" \
3978  " }\n" \
3979  " else if ((i == givrListParu.iNbr) && (j == givrListInst.iNbr))\n" \
3980  " {\n" \
3981  " /* fin de liste parution */\n" \
3982  " iFinParu = (int4)GIV::GIXCodeOK;\n" \
3983  " /* fin de liste installation */\n" \
3984  " iFinInst = (int4)GIV::GIXCodeOK;\n" \
3985  " }\n" \
3986  " else\n" \
3987  " {\n" \
3988  " /* Parution suivante */\n" \
3989  " k = givrListParu.trEltRangList[i];\n" \
3990  " /* Installation suivante */\n" \
3991  " l = givrListInst.trEltRangList[j];\n" \
3992  "\n" \
3993  " if (givrListParu.trEltList[kk].iRangTri != givrListParu.trEltList[k].iRangTri)\n" \
3994  " {\n" \
3995  " /* fin de rubrique dans liste parution */\n" \
3996  " i--;\n" \
3997  " iFinParu = (int4)GIV::GIXCodeOK;\n" \
3998  " }\n" \
3999  "\n" \
4000  " if (givrListInst.trEltList[ll].iRangTri != givrListInst.trEltList[l].iRangTri)\n" \
4001  " {\n" \
4002  " /* fin de rubrique dans liste installation */\n" \
4003  " j--;\n" \
4004  " iFinInst = (int4)GIV::GIXCodeOK;\n" \
4005  " }\n" \
4006  "\n" \
4007  " if (((int4)GIV::GIXCodeOK == iFinParu) && ((int4)GIV::GIXCodeOK == iFinInst))\n" \
4008  " {\n" \
4009  " iFinParu = (int4)GIV::GIXCodeKO;\n" \
4010  " i++;\n" \
4011  " iFinInst = (int4)GIV::GIXCodeKO;\n" \
4012  " j++;\n" \
4013  " }\n" \
4014  " }\n" \
4015  "\n" \
4016  " /* Parution suivante */\n" \
4017  " k = givrListParu.trEltRangList[i];\n" \
4018  " /* Installation suivante */\n" \
4019  " l = givrListInst.trEltRangList[j];\n" \
4020  " GWTTrace(GWT_NIV_FONCT, (\"Parution [%d],[%d]\\n\", i, j));\n" \
4021  " }\n" \
4022  "\n" \
4023  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
4024  " {\n" \
4025  " i = givrListParu.trEltRangList[j];\n" \
4026  " GWTTrace(GWT_NIV_FONCT, (\"Comp Parution [%s], [%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d],[%d]\\n\", givrListParu.trEltList[i].rub, givrListParu.trEltList[i].dep, givrListParu.trEltList[i].loc,\n" \
4027  " givrListParu.trEltList[i].arr, givrListParu.trEltList[i].reg, givrListParu.trEltList[i].iGeoReg, givrListParu.trEltList[i].iGeoDept, givrListParu.trEltList[i].iGeoLoc,\n" \
4028  " givrListParu.trEltList[i].iGeoArr, givrListParu.trEltList[i].iZU));\n" \
4029  " }\n" \
4030  "\n" \
4031  " for (j = 0; j < (givrListInst.iNbr); j++)\n" \
4032  " {\n" \
4033  " i = givrListInst.trEltRangList[j];\n" \
4034  " GWTTrace(GWT_NIV_FONCT, (\"Comp Installation [%s], [%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d]\\n\", givrListInst.trEltList[i].rub, givrListInst.trEltList[i].dep, givrListInst.trEltList[i].loc,\n" \
4035  " givrListInst.trEltList[i].arr, givrListInst.trEltList[i].reg, givrListInst.trEltList[i].iGeoReg, givrListInst.trEltList[i].iGeoDept, givrListInst.trEltList[i].iGeoLoc,\n" \
4036  " givrListInst.trEltList[i].iGeoArr));\n" \
4037  " }\n" \
4038  "\n" \
4039  " /* tranformation de codes Arr/Loc/Dept/Extra */\n" \
4040  " /* rang géograhique par rubrique */\n" \
4041  " iRgGeoRub = 0;\n" \
4042  " iRangRub = 0;\n" \
4043  "\n" \
4044  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
4045  " {\n" \
4046  " i = givrListParu.trEltRangList[j];\n" \
4047  "\n" \
4048  " if (iRangRub != givrListParu.trEltList[i].iRangTri)\n" \
4049  " {\n" \
4050  " iRangRub = givrListParu.trEltList[i].iRangTri;\n" \
4051  " iRgGeoRub = 0;\n" \
4052  " }\n" \
4053  "\n" \
4054  " if (99 != givrListParu.trEltList[i].iGeoReg)\n" \
4055  " iGeoReg = givrListParu.trEltList[i].iGeoReg;\n" \
4056  "\n" \
4057  " if (99 != givrListParu.trEltList[i].iGeoDept)\n" \
4058  " iGeoDept = givrListParu.trEltList[i].iGeoDept;\n" \
4059  "\n" \
4060  " if (99 != givrListParu.trEltList[i].iGeoLoc)\n" \
4061  " iGeoLoc = givrListParu.trEltList[i].iGeoLoc;\n" \
4062  "\n" \
4063  " if (99 != givrListParu.trEltList[i].iGeoArr)\n" \
4064  " iGeoArr = givrListParu.trEltList[i].iGeoArr;\n" \
4065  "\n" \
4066  " if (((int4)GIV::GIXCodeOK != iDblZU) && ((int4)GIV::GIXCodeOK == givrListParu.trEltList[i].iZU))\n" \
4067  " {\n" \
4068  " givrListParu.trEltList[i].iGeoReg = 99;\n" \
4069  " givrListParu.trEltList[i].iGeoDept = 99;\n" \
4070  " givrListParu.trEltList[i].iGeoLoc = 99;\n" \
4071  " givrListParu.trEltList[i].iGeoArr = 99;\n" \
4072  " iDblZU = (int4)GIV::GIXCodeOK;\n" \
4073  " }\n" \
4074  " else if (((int4)GIV::GIXCodeOK == iDblZU) && ((int4)GIV::GIXCodeOK == givrListParu.trEltList[i].iZU))\n" \
4075  " {\n" \
4076  " if ((99 != givrListParu.trEltList[i].iGeoReg) || (99 != givrListParu.trEltList[i].iGeoDept) || (99 != givrListParu.trEltList[i].iGeoLoc) || (99 != givrListParu.trEltList[i].iGeoArr))\n" \
4077  " {\n" \
4078  " /* changement de ZU */\n" \
4079  " }\n" \
4080  "\n" \
4081  " givrListParu.trEltList[i].iGeoReg = 99;\n" \
4082  " givrListParu.trEltList[i].iGeoDept = 99;\n" \
4083  " givrListParu.trEltList[i].iGeoLoc = 99;\n" \
4084  " givrListParu.trEltList[i].iGeoArr = 99;\n" \
4085  " }\n" \
4086  " else if (((int4)GIV::GIXCodeOK == iDblZU) && ((int4)GIV::GIXCodeOK != givrListParu.trEltList[i].iZU))\n" \
4087  " {\n" \
4088  " if ((99 == givrListParu.trEltList[i].iGeoReg) && (99 == givrListParu.trEltList[i].iGeoDept) && (99 == givrListParu.trEltList[i].iGeoLoc))\n" \
4089  " {\n" \
4090  " /* parution sur même ZU */\n" \
4091  " givrListParu.trEltList[i].iZU = (int4)GIV::GIXCodeOK;\n" \
4092  " }\n" \
4093  "\n" \
4094  " if (99 == givrListParu.trEltList[i].iGeoReg)\n" \
4095  " givrListParu.trEltList[i].iGeoReg = iGeoReg;\n" \
4096  "\n" \
4097  " if (99 == givrListParu.trEltList[i].iGeoDept)\n" \
4098  " givrListParu.trEltList[i].iGeoDept = iGeoDept;\n" \
4099  "\n" \
4100  " if (99 == givrListParu.trEltList[i].iGeoLoc)\n" \
4101  " givrListParu.trEltList[i].iGeoLoc = iGeoLoc;\n" \
4102  "\n" \
4103  " if (99 == givrListParu.trEltList[i].iGeoArr)\n" \
4104  " givrListParu.trEltList[i].iGeoArr = iGeoArr;\n" \
4105  "\n" \
4106  " iDblZU = (int4)GIV::GIXCodeKO;\n" \
4107  " }\n" \
4108  "\n" \
4109  " if (GIV::giv_LOC == iGeoReg)\n" \
4110  " {\n" \
4111  " if (GIV::giv_LOC == iGeoDept)\n" \
4112  " {\n" \
4113  " if (GIV::giv_LOC == iGeoLoc)\n" \
4114  " {\n" \
4115  " if (99 != givrListParu.trEltList[i].iGeoReg)\n" \
4116  " givrListParu.trEltList[i].iGeoReg = GIV::giv_REG;\n" \
4117  "\n" \
4118  " if (99 != givrListParu.trEltList[i].iGeoDept)\n" \
4119  " givrListParu.trEltList[i].iGeoDept = GIV::giv_DEPT;\n" \
4120  "\n" \
4121  " if (99 != givrListParu.trEltList[i].iGeoLoc)\n" \
4122  " givrListParu.trEltList[i].iGeoLoc = GIV::giv_LOC;\n" \
4123  "\n" \
4124  " if ((GIV::giv_EXTL == iGeoArr) && (99 != givrListParu.trEltList[i].iGeoArr))\n" \
4125  " givrListParu.trEltList[i].iGeoArr = GIV::giv_LOC;\n" \
4126  " else if ((GIV::giv_ARR == iGeoArr) && (99 != givrListParu.trEltList[i].iGeoArr))\n" \
4127  " givrListParu.trEltList[i].iGeoArr = GIV::giv_ARR;\n" \
4128  " else\n" \
4129  " givrListParu.trEltList[i].iGeoArr = 99;\n" \
4130  " }\n" \
4131  " else\n" \
4132  " {\n" \
4133  " if (99 != givrListParu.trEltList[i].iGeoReg)\n" \
4134  " givrListParu.trEltList[i].iGeoReg = GIV::giv_REG;\n" \
4135  "\n" \
4136  " if (99 != givrListParu.trEltList[i].iGeoDept)\n" \
4137  " givrListParu.trEltList[i].iGeoDept = GIV::giv_DEPT;\n" \
4138  "\n" \
4139  " if (99 != givrListParu.trEltList[i].iGeoLoc)\n" \
4140  " givrListParu.trEltList[i].iGeoLoc = GIV::giv_DEPT;\n" \
4141  "\n" \
4142  " if ((GIV::giv_EXTL == iGeoArr) && (99 != givrListParu.trEltList[i].iGeoArr))\n" \
4143  " givrListParu.trEltList[i].iGeoArr = GIV::giv_DEPT;\n" \
4144  " else\n" \
4145  " givrListParu.trEltList[i].iGeoArr = 99;\n" \
4146  " }\n" \
4147  " }\n" \
4148  " else\n" \
4149  " {\n" \
4150  " if (99 != givrListParu.trEltList[i].iGeoReg)\n" \
4151  " givrListParu.trEltList[i].iGeoReg = GIV::giv_REG;\n" \
4152  "\n" \
4153  " if (99 != givrListParu.trEltList[i].iGeoDept)\n" \
4154  " givrListParu.trEltList[i].iGeoDept = GIV::giv_EXTL;\n" \
4155  "\n" \
4156  " if (99 != givrListParu.trEltList[i].iGeoLoc)\n" \
4157  " givrListParu.trEltList[i].iGeoLoc = GIV::giv_EXTL;\n" \
4158  "\n" \
4159  " if ((GIV::giv_EXTL == iGeoArr) && (99 != givrListParu.trEltList[i].iGeoArr))\n" \
4160  " givrListParu.trEltList[i].iGeoArr = GIV::giv_EXTL;\n" \
4161  " else\n" \
4162  " givrListParu.trEltList[i].iGeoArr = 99;\n" \
4163  " }\n" \
4164  " }\n" \
4165  " else\n" \
4166  " {\n" \
4167  " if (99 != givrListParu.trEltList[i].iGeoReg)\n" \
4168  " givrListParu.trEltList[i].iGeoReg = GIV::giv_EXTL;\n" \
4169  "\n" \
4170  " if (99 != givrListParu.trEltList[i].iGeoDept)\n" \
4171  " givrListParu.trEltList[i].iGeoDept = GIV::giv_EXTL;\n" \
4172  "\n" \
4173  " if (99 != givrListParu.trEltList[i].iGeoLoc)\n" \
4174  " givrListParu.trEltList[i].iGeoLoc = GIV::giv_EXTL;\n" \
4175  "\n" \
4176  " if ((GIV::giv_EXTL == iGeoArr) && (99 != givrListParu.trEltList[i].iGeoArr))\n" \
4177  " givrListParu.trEltList[i].iGeoArr = GIV::giv_EXTL;\n" \
4178  " else\n" \
4179  " givrListParu.trEltList[i].iGeoArr = 99;\n" \
4180  " }\n" \
4181  "\n" \
4182  " if ((99 == givrListParu.trEltList[i].iGeoReg) && (99 == givrListParu.trEltList[i].iGeoDept) && (99 == givrListParu.trEltList[i].iGeoLoc) && ((98 == givrListParu.trEltList[i].iGeoArr)\n" \
4183  " || (99 == givrListParu.trEltList[i].iGeoArr)))\n" \
4184  " givrListParu.trEltList[i].iRgGeoTri = -1;\n" \
4185  " else\n" \
4186  " {\n" \
4187  " givrListParu.trEltList[i].iRgGeoTri = iRgGeoRub;\n" \
4188  " iRgGeoRub++;\n" \
4189  " }\n" \
4190  "\n" \
4191  " if (0 == strcmp(\"999\", givrListParu.trEltList[i].dep))\n" \
4192  " {\n" \
4193  " /* ancienne région : seule la parution sur région est validée */\n" \
4194  " givrListParu.trEltList[i].iGeoDept = GIV::giv_DFT;\n" \
4195  " givrListParu.trEltList[i].iGeoLoc = GIV::giv_DFT;\n" \
4196  " givrListParu.trEltList[i].iGeoArr = GIV::giv_DFT;\n" \
4197  " givrListParu.trEltList[i].iGeoArr = GIV::giv_DFT;\n" \
4198  " }\n" \
4199  " }\n" \
4200  "\n" \
4201  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
4202  " {\n" \
4203  " i = givrListParu.trEltRangList[j];\n" \
4204  " GWTTrace(GWT_NIV_FONCT, (\"Parution Géo-Dénom [%s], [%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d],[%d]\\n\", givrListParu.trEltList[i].rub, givrListParu.trEltList[i].dep, givrListParu.trEltList[i].loc,\n" \
4205  " givrListParu.trEltList[i].arr, givrListParu.trEltList[i].reg, givrListParu.trEltList[i].iGeoReg, givrListParu.trEltList[i].iGeoDept, givrListParu.trEltList[i].iGeoLoc,\n" \
4206  " givrListParu.trEltList[i].iGeoArr, givrListParu.trEltList[i].iZU));\n" \
4207  " }\n" \
4208  "\n" \
4209  " for (j = 1; (j < (givrListParu.iNbr) && GIV::giv_RUB == iTri); j++)\n" \
4210  " {\n" \
4211  " /* restauration des iGeo pour dénom différentes */\n" \
4212  " i = givrListParu.trEltRangList[j];\n" \
4213  " ii = givrListParu.trEltRangList[j - 1];\n" \
4214  "\n" \
4215  " if (99 == givrListParu.trEltList[i].iGeoReg)\n" \
4216  " givrListParu.trEltList[i].iGeoReg = givrListParu.trEltList[ii].iGeoReg;\n" \
4217  "\n" \
4218  " if (99 == givrListParu.trEltList[i].iGeoDept)\n" \
4219  " givrListParu.trEltList[i].iGeoDept = givrListParu.trEltList[ii].iGeoDept;\n" \
4220  "\n" \
4221  " if (99 == givrListParu.trEltList[i].iGeoLoc)\n" \
4222  " givrListParu.trEltList[i].iGeoLoc = givrListParu.trEltList[ii].iGeoLoc;\n" \
4223  "\n" \
4224  " if (99 == givrListParu.trEltList[i].iGeoArr)\n" \
4225  " givrListParu.trEltList[i].iGeoArr = givrListParu.trEltList[ii].iGeoArr;\n" \
4226  "\n" \
4227  " if (98 == givrListParu.trEltList[i].iGeoArr)\n" \
4228  " givrListParu.trEltList[i].iGeoArr = givrListParu.trEltList[ii].iGeoArr;\n" \
4229  " }\n" \
4230  "\n" \
4231  " for (j = 0; (j < (givrListParu.iNbr) && GIV::giv_RUB == iTri); j++)\n" \
4232  " {\n" \
4233  " /* pas de restauration des iGeo pour iZU */\n" \
4234  " i = givrListParu.trEltRangList[j];\n" \
4235  "\n" \
4236  " if ((-1 == givrListParu.trEltList[i].iRgGeoTri) && ((int4)GIV::GIXCodeOK == givrListParu.trEltList[i].iZU))\n" \
4237  " {\n" \
4238  " givrListParu.trEltList[i].iGeoReg = 99;\n" \
4239  " givrListParu.trEltList[i].iGeoDept = 99;\n" \
4240  " givrListParu.trEltList[i].iGeoLoc = 99;\n" \
4241  " givrListParu.trEltList[i].iGeoArr = 99;\n" \
4242  " }\n" \
4243  " }\n" \
4244  "\n" \
4245  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
4246  " {\n" \
4247  " i = givrListParu.trEltRangList[j];\n" \
4248  " GWTTrace(GWT_NIV_FONCT, (\"Parution Géo-Dénom [%s], [%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d],[%d]\\n\", givrListParu.trEltList[i].rub, givrListParu.trEltList[i].dep, givrListParu.trEltList[i].loc,\n" \
4249  " givrListParu.trEltList[i].arr, givrListParu.trEltList[i].reg, givrListParu.trEltList[i].iGeoReg, givrListParu.trEltList[i].iGeoDept, givrListParu.trEltList[i].iGeoLoc,\n" \
4250  " givrListParu.trEltList[i].iGeoArr, givrListParu.trEltList[i].iZU));\n" \
4251  " }\n" \
4252  "\n" \
4253  "#if 0\n" \
4254  "\n" \
4255  " for (j = 1; (j < (givrListInst.iNbr) && GIV::giv_RUB == iTri); j++)\n" \
4256  " {\n" \
4257  " /* restauration des iGeoArr d'installation pour dénom différentes */\n" \
4258  " i = givrListInst.trEltRangList[j];\n" \
4259  " ii = givrListInst.trEltRangList[j - 1];\n" \
4260  "\n" \
4261  " if (99 == givrListInst.trEltList[i].iGeoArr)\n" \
4262  " givrListInst.trEltList[i].iGeoArr = givrListInst.trEltList[ii].iGeoArr;\n" \
4263  "\n" \
4264  " if (98 == givrListInst.trEltList[i].iGeoArr)\n" \
4265  " givrListInst.trEltList[i].iGeoArr = givrListInst.trEltList[ii].iGeoArr;\n" \
4266  " }\n" \
4267  "\n" \
4268  "#endif\n" \
4269  " iRgGeoRub = 0;\n" \
4270  " iRangRub = 0;\n" \
4271  "\n" \
4272  " for (j = 0; j < (givrListInst.iNbr); j++)\n" \
4273  " {\n" \
4274  " i = givrListInst.trEltRangList[j];\n" \
4275  "\n" \
4276  " if (iRangRub != givrListInst.trEltList[i].iRangTri)\n" \
4277  " {\n" \
4278  " iRangRub = givrListInst.trEltList[i].iRangTri;\n" \
4279  " iRgGeoRub = 0;\n" \
4280  " }\n" \
4281  "\n" \
4282  " if ((99 == givrListInst.trEltList[i].iGeoReg) && (99 == givrListInst.trEltList[i].iGeoDept) && (99 == givrListInst.trEltList[i].iGeoLoc) && ((98 == givrListInst.trEltList[i].iGeoArr)\n" \
4283  " || (99 == givrListInst.trEltList[i].iGeoArr)))\n" \
4284  " givrListInst.trEltList[i].iRgGeoTri = -1;\n" \
4285  " else\n" \
4286  " {\n" \
4287  " givrListInst.trEltList[i].iRgGeoTri = iRgGeoRub;\n" \
4288  " iRgGeoRub++;\n" \
4289  " }\n" \
4290  " }\n" \
4291  "\n" \
4292  " /* nombre de rangs géographiques significatifs par rubrique */\n" \
4293  " iNbGeoRub = 0;\n" \
4294  " iRangRub = 0;\n" \
4295  " iRangDeb = 0;\n" \
4296  "\n" \
4297  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
4298  " {\n" \
4299  " i = givrListParu.trEltRangList[j];\n" \
4300  "\n" \
4301  " if (iRangRub != givrListParu.trEltList[i].iRangTri)\n" \
4302  " {\n" \
4303  " iRgGeoRub = 0;\n" \
4304  "\n" \
4305  " for (l = iRangDeb; l < j; l++)\n" \
4306  " {\n" \
4307  " k = givrListParu.trEltRangList[l];\n" \
4308  " givrListParu.trEltList[k].iNbGeoTri = iNbGeoRub;\n" \
4309  "\n" \
4310  " if (-1 != givrListParu.trEltList[k].iRgGeoTri)\n" \
4311  " {\n" \
4312  " givrListParu.trEltList[k].iRgGeoTri = iRgGeoRub;\n" \
4313  " iRgGeoRub++;\n" \
4314  " }\n" \
4315  " }\n" \
4316  "\n" \
4317  " iRangRub = givrListParu.trEltList[i].iRangTri;\n" \
4318  " iNbGeoRub = 0;\n" \
4319  " iRangDeb = j;\n" \
4320  " }\n" \
4321  "\n" \
4322  " if (-1 != givrListParu.trEltList[i].iRgGeoTri)\n" \
4323  " iNbGeoRub++;\n" \
4324  "\n" \
4325  " if ((givrListParu.iNbr - 1) == j)\n" \
4326  " {\n" \
4327  " iRgGeoRub = 0;\n" \
4328  "\n" \
4329  " for (l = iRangDeb; l < (givrListParu.iNbr); l++)\n" \
4330  " {\n" \
4331  " k = givrListParu.trEltRangList[l];\n" \
4332  " givrListParu.trEltList[k].iNbGeoTri = iNbGeoRub;\n" \
4333  "\n" \
4334  " if (-1 != givrListParu.trEltList[k].iRgGeoTri)\n" \
4335  " {\n" \
4336  " givrListParu.trEltList[k].iRgGeoTri = iRgGeoRub;\n" \
4337  " iRgGeoRub++;\n" \
4338  " }\n" \
4339  " }\n" \
4340  " }\n" \
4341  " }\n" \
4342  "\n" \
4343  " iNbGeoRub = 0;\n" \
4344  " iRangRub = 0;\n" \
4345  " iRangDeb = 0;\n" \
4346  "\n" \
4347  " for (j = 0; j < (givrListInst.iNbr); j++)\n" \
4348  " {\n" \
4349  " i = givrListInst.trEltRangList[j];\n" \
4350  "\n" \
4351  " if (iRangRub != givrListInst.trEltList[i].iRangTri)\n" \
4352  " {\n" \
4353  " iRgGeoRub = 0;\n" \
4354  "\n" \
4355  " for (l = iRangDeb; l < j; l++)\n" \
4356  " {\n" \
4357  " k = givrListInst.trEltRangList[l];\n" \
4358  " givrListInst.trEltList[k].iNbGeoTri = iNbGeoRub;\n" \
4359  "\n" \
4360  " if (-1 != givrListInst.trEltList[k].iRgGeoTri)\n" \
4361  " {\n" \
4362  " givrListInst.trEltList[k].iRgGeoTri = iRgGeoRub;\n" \
4363  " iRgGeoRub++;\n" \
4364  " }\n" \
4365  " }\n" \
4366  "\n" \
4367  " iRangRub = givrListInst.trEltList[i].iRangTri;\n" \
4368  " iNbGeoRub = 0;\n" \
4369  " iRangDeb = j;\n" \
4370  " }\n" \
4371  "\n" \
4372  " if (-1 != givrListInst.trEltList[i].iRgGeoTri)\n" \
4373  " iNbGeoRub++;\n" \
4374  "\n" \
4375  " if ((givrListInst.iNbr - 1) == j)\n" \
4376  " {\n" \
4377  " iRgGeoRub = 0;\n" \
4378  "\n" \
4379  " for (l = iRangDeb; l < (givrListInst.iNbr); l++)\n" \
4380  " {\n" \
4381  " k = givrListInst.trEltRangList[l];\n" \
4382  " givrListInst.trEltList[k].iNbGeoTri = iNbGeoRub;\n" \
4383  "\n" \
4384  " if (-1 != givrListInst.trEltList[k].iRgGeoTri)\n" \
4385  " {\n" \
4386  " givrListInst.trEltList[k].iRgGeoTri = iRgGeoRub;\n" \
4387  " iRgGeoRub++;\n" \
4388  " }\n" \
4389  " }\n" \
4390  " }\n" \
4391  " }\n" \
4392  "\n" \
4393  " /* tri en fonction des tailles de blocs par geo/rub */\n" \
4394  " /* liste installation */\n" \
4395  " qsort(givrListInst.trEltRangList, givrListInst.iNbr, sizeof(int4), givCompListInstTaille);\n" \
4396  "\n" \
4397  " if (GIV::giv_OBJ != iTri)\n" \
4398  " givrListInst.iNbrTot = givrListInst.iNbr;\n" \
4399  "\n" \
4400  " for (j = 0; j < (givrListInst.iNbr); j++)\n" \
4401  " {\n" \
4402  " i = givrListInst.trEltRangList[j];\n" \
4403  " givrListInst.trEltList[i].iRgTriDbl = -1;\n" \
4404  "\n" \
4405  " if (-1 == givrListInst.trEltList[i].iRgGeoTri)\n" \
4406  " {\n" \
4407  " givrListInst.iNbr = j;\n" \
4408  " break;\n" \
4409  " }\n" \
4410  " }\n" \
4411  "\n" \
4412  " GWTTrace(GWT_NIV_FONCT, (\"givTriGeo 3 \\n\"));\n" \
4413  "\n" \
4414  " for (j = 0; j < (givrListInst.iNbr); j++)\n" \
4415  " {\n" \
4416  " i = givrListInst.trEltRangList[j];\n" \
4417  " GWTTrace(GWT_NIV_FONCT, (\"Installation [%d],[%d],[%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d]\\n\", givrListInst.trEltList[i].iRgGeoTri, givrListInst.trEltList[i].iNbGeoTri,\n" \
4418  " givrListInst.trEltList[i].iRangTri, givrListInst.trEltList[i].rub, givrListInst.trEltList[i].dep, givrListInst.trEltList[i].loc, givrListInst.trEltList[i].arr, givrListInst.trEltList[i].reg,\n" \
4419  " givrListInst.trEltList[i].iGeoReg, givrListInst.trEltList[i].iGeoDept, givrListInst.trEltList[i].iGeoLoc, givrListInst.trEltList[i].iGeoArr));\n" \
4420  " }\n" \
4421  "\n" \
4422  " /* recherche des rubriques ayant même géographie */\n" \
4423  " /* recherche des rubriques ayant même géographie */\n" \
4424  " /* liste installation */\n" \
4425  " j = 0;\n" \
4426  "\n" \
4427  " while (j < givrListInst.iNbr)\n" \
4428  " {\n" \
4429  " i = givrListInst.trEltRangList[j];\n" \
4430  "\n" \
4431  " if (-1 == givrListInst.trEltList[i].iRgTriDbl)\n" \
4432  " givrListInst.trEltList[i].iRgTriDbl = givrListInst.trEltList[i].iRangTri;\n" \
4433  "\n" \
4434  " GWTTrace(GWT_NIV_FONCT, (\"iRgRubDbl [%d]\\n\", givrListInst.trEltList[i].iRgTriDbl));\n" \
4435  " iNbGeoRub = givrListInst.trEltList[i].iNbGeoTri;\n" \
4436  " l = j + iNbGeoRub;\n" \
4437  " k = givrListInst.trEltRangList[l];\n" \
4438  "\n" \
4439  " while ((l < givrListInst.iNbr) && (givrListInst.trEltList[i].iRangTri == givrListInst.trEltList[i].iRgTriDbl))\n" \
4440  " {\n" \
4441  " if ((givrListInst.trEltList[i].iNbGeoTri != givrListInst.trEltList[k].iNbGeoTri) || (-1 != givrListInst.trEltList[k].iRgTriDbl))\n" \
4442  " {\n" \
4443  " /* tailles différentes ou déjà doublé */\n" \
4444  " iNbGeoRub = givrListInst.trEltList[k].iNbGeoTri;\n" \
4445  " l = l + iNbGeoRub;\n" \
4446  " k = givrListInst.trEltRangList[l];\n" \
4447  " }\n" \
4448  " else\n" \
4449  " {\n" \
4450  " /* même taille */\n" \
4451  " for (m = 0; m < iNbGeoRub; m++)\n" \
4452  " {\n" \
4453  " if (givrListInst.trEltList[givrListInst.trEltRangList[j + m]].iRgGeoTri != givrListInst.trEltList[givrListInst.trEltRangList[l + m]].iRgGeoTri)\n" \
4454  " {\n" \
4455  " /* rangs différents */\n" \
4456  " break;\n" \
4457  " }\n" \
4458  "\n" \
4459  " if (0 != strcmp(givrListInst.trEltList[givrListInst.trEltRangList[j + m]].reg, givrListInst.trEltList[givrListInst.trEltRangList[l + m]].reg))\n" \
4460  " break;\n" \
4461  "\n" \
4462  " if (0 != strcmp(givrListInst.trEltList[givrListInst.trEltRangList[j + m]].dep, givrListInst.trEltList[givrListInst.trEltRangList[l + m]].dep))\n" \
4463  " break;\n" \
4464  "\n" \
4465  " if (0 != strcmp(givrListInst.trEltList[givrListInst.trEltRangList[j + m]].loc, givrListInst.trEltList[givrListInst.trEltRangList[l + m]].loc))\n" \
4466  " break;\n" \
4467  "\n" \
4468  " if (0 != strcmp(givrListInst.trEltList[givrListInst.trEltRangList[j + m]].arr, givrListInst.trEltList[givrListInst.trEltRangList[l + m]].arr))\n" \
4469  " break;\n" \
4470  "\n" \
4471  " if (givrListInst.trEltList[givrListInst.trEltRangList[j + m]].iGeoArr != givrListInst.trEltList[givrListInst.trEltRangList[l + m]].iGeoArr)\n" \
4472  " break;\n" \
4473  " }\n" \
4474  "\n" \
4475  " if (m == iNbGeoRub)\n" \
4476  " {\n" \
4477  " /* égalité complète des rubriques */\n" \
4478  " givrListInst.trEltList[k].iRgTriDbl = givrListInst.trEltList[i].iRgTriDbl;\n" \
4479  " /* nombre de rubriques */\n" \
4480  " GWTTrace(GWT_NIV_FONCT, (\"Partie 3 Nombre de rubriques [%d]\\n\", givrListInst.iNbrTri));\n" \
4481  " }\n" \
4482  "\n" \
4483  " GWTTrace(GWT_NIV_FONCT, (\"iRgRubDbl [%d]\\n\", givrListInst.trEltList[k].iRgTriDbl));\n" \
4484  " /* rubrique suivante */\n" \
4485  " iNbGeoRub = givrListInst.trEltList[k].iNbGeoTri;\n" \
4486  " l = l + iNbGeoRub;\n" \
4487  " k = givrListInst.trEltRangList[l];\n" \
4488  " }\n" \
4489  " }\n" \
4490  "\n" \
4491  " iNbGeoRub = givrListInst.trEltList[i].iNbGeoTri;\n" \
4492  " j = j + iNbGeoRub;\n" \
4493  " }\n" \
4494  "\n" \
4495  " for (j = 0; (j < givrListInst.iNbr && GIV::giv_RUB == iTri); j++)\n" \
4496  " {\n" \
4497  " /* restauration de iRgTriDbl */\n" \
4498  " jj = givrListInst.trEltRangList[j];\n" \
4499  "\n" \
4500  " if (-1 != givrListInst.trEltList[jj].iRgTriDbl)\n" \
4501  " ii = jj;\n" \
4502  " else\n" \
4503  " givrListInst.trEltList[jj].iRgTriDbl = givrListInst.trEltList[ii].iRgTriDbl;\n" \
4504  " }\n" \
4505  "\n" \
4506  " for (j = givrListInst.iNbr; (j < givrListInst.iNbrTot && GIV::giv_RUB == iTri); j++)\n" \
4507  " {\n" \
4508  " /* restauration de iRgTriDbl */\n" \
4509  " jj = givrListInst.trEltRangList[j];\n" \
4510  "\n" \
4511  " for (i = 0; i < givrListInst.iNbr; i++)\n" \
4512  " {\n" \
4513  " ii = givrListInst.trEltRangList[i];\n" \
4514  "\n" \
4515  " if (givrListInst.trEltList[ii].iRangTri == givrListInst.trEltList[jj].iRangTri)\n" \
4516  " {\n" \
4517  " givrListInst.trEltList[jj].iRgTriDbl = givrListInst.trEltList[ii].iRgTriDbl;\n" \
4518  " break;\n" \
4519  " }\n" \
4520  " }\n" \
4521  " }\n" \
4522  "\n" \
4523  " /* recherche des rubriques ayant même géographie */\n" \
4524  " /* listes parution et installation confondues */\n" \
4525  "\n" \
4526  " for (j = 0; j < givrListParu.iNbr; j++)\n" \
4527  " {\n" \
4528  " i = givrListParu.trEltRangList[j];\n" \
4529  "\n" \
4530  " /* même rubrique parution/installation */\n" \
4531  " for (l = 0; l < givrListInst.iNbr; l++)\n" \
4532  " {\n" \
4533  " k = givrListInst.trEltRangList[l];\n" \
4534  "\n" \
4535  " if (givrListParu.trEltList[i].iRangTri == givrListInst.trEltList[k].iRangTri)\n" \
4536  " {\n" \
4537  " givrListParu.trEltList[i].iRgTriDblBis = givrListInst.trEltList[k].iRgTriDbl;\n" \
4538  " break;\n" \
4539  " }\n" \
4540  " }\n" \
4541  "\n" \
4542  " if (givrListInst.iNbr == l)\n" \
4543  " {\n" \
4544  " /* pas de rubrique installation */\n" \
4545  " givrListParu.trEltList[i].iRgTriDblBis = -1;\n" \
4546  " }\n" \
4547  "\n" \
4548  " GWTTrace(GWT_NIV_FONCT, (\"iRgRubDblBis [%d]\\n\", givrListParu.trEltList[i].iRgTriDblBis));\n" \
4549  " }\n" \
4550  "\n" \
4551  " /* tri en fonction des tailles de blocs par geo/rub */\n" \
4552  " /* liste parution */\n" \
4553  " qsort(givrListParu.trEltRangList, givrListParu.iNbr, sizeof(int4), givCompListParuTaille);\n" \
4554  "\n" \
4555  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
4556  " {\n" \
4557  " i = givrListParu.trEltRangList[j];\n" \
4558  " GWTTrace(GWT_NIV_FONCT, (\"Parution Tri Taille[%d],[%d],[%d],[%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d],[%d],[%d]\\n\", givrListParu.trEltList[i].iRgGeoTri, givrListParu.trEltList[i].iNbGeoTri,\n" \
4559  " givrListParu.trEltList[i].iRangTri, givrListParu.trEltList[i].iRgTriDbl, givrListParu.trEltList[i].rub, givrListParu.trEltList[i].dep, givrListParu.trEltList[i].loc, givrListParu.trEltList[i].arr,\n" \
4560  " givrListParu.trEltList[i].reg, givrListParu.trEltList[i].iGeoReg, givrListParu.trEltList[i].iGeoDept, givrListParu.trEltList[i].iGeoLoc, givrListParu.trEltList[i].iGeoArr,\n" \
4561  " givrListParu.trEltList[i].iZU, givrListParu.trEltList[i].iRgLigne));\n" \
4562  " }\n" \
4563  "\n" \
4564  " if (GIV::giv_RUB == iTri)\n" \
4565  " {\n" \
4566  " /* il peut y avoir des objets hors tri */\n" \
4567  " givrListParu.iNbrTot = givrListParu.iNbr;\n" \
4568  " }\n" \
4569  "\n" \
4570  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
4571  " {\n" \
4572  " i = givrListParu.trEltRangList[j];\n" \
4573  " givrListParu.trEltList[i].iRgTriDbl = -1;\n" \
4574  "\n" \
4575  " if (-1 == givrListParu.trEltList[i].iRgGeoTri)\n" \
4576  " {\n" \
4577  " givrListParu.iNbr = j;\n" \
4578  " break;\n" \
4579  " }\n" \
4580  " }\n" \
4581  "\n" \
4582  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
4583  " {\n" \
4584  " i = givrListParu.trEltRangList[j];\n" \
4585  " GWTTrace(GWT_NIV_FONCT, (\"Parution Tri Taille[%d],[%d],[%d],[%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d],[%d],[%d]\\n\", givrListParu.trEltList[i].iRgGeoTri, givrListParu.trEltList[i].iNbGeoTri,\n" \
4586  " givrListParu.trEltList[i].iRangTri, givrListParu.trEltList[i].iRgTriDbl, givrListParu.trEltList[i].rub, givrListParu.trEltList[i].dep, givrListParu.trEltList[i].loc, givrListParu.trEltList[i].arr,\n" \
4587  " givrListParu.trEltList[i].reg, givrListParu.trEltList[i].iGeoReg, givrListParu.trEltList[i].iGeoDept, givrListParu.trEltList[i].iGeoLoc, givrListParu.trEltList[i].iGeoArr,\n" \
4588  " givrListParu.trEltList[i].iZU, givrListParu.trEltList[i].iRgLigne));\n" \
4589  " }\n" \
4590  "\n" \
4591  " /* recherche des rubriques ayant même géographie */\n" \
4592  " /* liste parution */\n" \
4593  " j = 0;\n" \
4594  "\n" \
4595  " while (j < givrListParu.iNbr)\n" \
4596  " {\n" \
4597  " i = givrListParu.trEltRangList[j];\n" \
4598  "\n" \
4599  " if (-1 == givrListParu.trEltList[i].iRgTriDbl)\n" \
4600  " givrListParu.trEltList[i].iRgTriDbl = givrListParu.trEltList[i].iRangTri;\n" \
4601  "\n" \
4602  " GWTTrace(GWT_NIV_FONCT, (\"iRgRubDbl [%d],[%d]\\n\", givrListParu.trEltList[i].iRgTriDbl, givrListParu.trEltList[i].iRangTri));\n" \
4603  " iNbGeoRub = givrListParu.trEltList[i].iNbGeoTri;\n" \
4604  " l = j + iNbGeoRub;\n" \
4605  " k = givrListParu.trEltRangList[l];\n" \
4606  "\n" \
4607  " while ((l < givrListParu.iNbr) && (givrListParu.trEltList[i].iRangTri == givrListParu.trEltList[i].iRgTriDbl))\n" \
4608  " {\n" \
4609  " if ((givrListParu.trEltList[i].iNbGeoTri != givrListParu.trEltList[k].iNbGeoTri) || (-1 != givrListParu.trEltList[k].iRgTriDbl))\n" \
4610  " {\n" \
4611  " /* tailles différentes ou déjà doublé */\n" \
4612  " iNbGeoRub = givrListParu.trEltList[k].iNbGeoTri;\n" \
4613  " l = l + iNbGeoRub;\n" \
4614  " k = givrListParu.trEltRangList[l];\n" \
4615  " }\n" \
4616  " else if (givrListParu.trEltList[i].iRgTriDblBis != givrListParu.trEltList[k].iRgTriDblBis)\n" \
4617  " {\n" \
4618  " /* installations différentes */\n" \
4619  " iNbGeoRub = givrListParu.trEltList[k].iNbGeoTri;\n" \
4620  " l = l + iNbGeoRub;\n" \
4621  " k = givrListParu.trEltRangList[l];\n" \
4622  " }\n" \
4623  " else\n" \
4624  " {\n" \
4625  " /* même taille */\n" \
4626  " for (m = 0; m < iNbGeoRub; m++)\n" \
4627  " {\n" \
4628  " if (givrListParu.trEltList[givrListParu.trEltRangList[j + m]].iRgGeoTri != givrListParu.trEltList[givrListParu.trEltRangList[l + m]].iRgGeoTri)\n" \
4629  " {\n" \
4630  " /* rangs différents */\n" \
4631  " break;\n" \
4632  " }\n" \
4633  "\n" \
4634  " if (0 != strcmp(givrListParu.trEltList[givrListParu.trEltRangList[j + m]].reg, givrListParu.trEltList[givrListParu.trEltRangList[l + m]].reg))\n" \
4635  " break;\n" \
4636  "\n" \
4637  " if (givrListParu.trEltList[givrListParu.trEltRangList[j + m]].iGeoReg != givrListParu.trEltList[givrListParu.trEltRangList[l + m]].iGeoReg)\n" \
4638  " break;\n" \
4639  "\n" \
4640  " if (0 != strcmp(givrListParu.trEltList[givrListParu.trEltRangList[j + m]].dep, givrListParu.trEltList[givrListParu.trEltRangList[l + m]].dep))\n" \
4641  " break;\n" \
4642  "\n" \
4643  " if (givrListParu.trEltList[givrListParu.trEltRangList[j + m]].iGeoDept != givrListParu.trEltList[givrListParu.trEltRangList[l + m]].iGeoDept)\n" \
4644  " break;\n" \
4645  "\n" \
4646  " if (0 != strcmp(givrListParu.trEltList[givrListParu.trEltRangList[j + m]].loc, givrListParu.trEltList[givrListParu.trEltRangList[l + m]].loc))\n" \
4647  " break;\n" \
4648  "\n" \
4649  " if (givrListParu.trEltList[givrListParu.trEltRangList[j + m]].iGeoLoc != givrListParu.trEltList[givrListParu.trEltRangList[l + m]].iGeoLoc)\n" \
4650  " break;\n" \
4651  "\n" \
4652  " if (0 != strcmp(givrListParu.trEltList[givrListParu.trEltRangList[j + m]].arr, givrListParu.trEltList[givrListParu.trEltRangList[l + m]].arr))\n" \
4653  " break;\n" \
4654  "\n" \
4655  " if (givrListParu.trEltList[givrListParu.trEltRangList[j + m]].iGeoArr != givrListParu.trEltList[givrListParu.trEltRangList[l + m]].iGeoArr)\n" \
4656  " break;\n" \
4657  "\n" \
4658  " if (givrListParu.trEltList[givrListParu.trEltRangList[j + m]].iZU != givrListParu.trEltList[givrListParu.trEltRangList[l + m]].iZU)\n" \
4659  " break;\n" \
4660  "\n" \
4661  " if (givrListParu.trEltList[givrListParu.trEltRangList[j + m]].cParuloc != givrListParu.trEltList[givrListParu.trEltRangList[l + m]].cParuloc)\n" \
4662  " break;\n" \
4663  " }\n" \
4664  "\n" \
4665  " if (m == iNbGeoRub)\n" \
4666  " {\n" \
4667  " /* égalité complète des rubriques */\n" \
4668  " givrListParu.trEltList[k].iRgTriDbl = givrListParu.trEltList[i].iRgTriDbl;\n" \
4669  " /* nombre de rubriques */\n" \
4670  " GWTTrace(GWT_NIV_FONCT, (\"Partie 3 Nombre de rubriques [%d]\\n\", givrListParu.iNbrTri));\n" \
4671  " }\n" \
4672  "\n" \
4673  " GWTTrace(GWT_NIV_FONCT, (\"iRgRubDbl [%d],[%d]\\n\", givrListParu.trEltList[k].iRgTriDbl, givrListParu.trEltList[k].iRangTri));\n" \
4674  " /* rubrique suivante */\n" \
4675  " iNbGeoRub = givrListParu.trEltList[k].iNbGeoTri;\n" \
4676  " l = l + iNbGeoRub;\n" \
4677  " k = givrListParu.trEltRangList[l];\n" \
4678  " }\n" \
4679  " }\n" \
4680  "\n" \
4681  " iNbGeoRub = givrListParu.trEltList[i].iNbGeoTri;\n" \
4682  " j = j + iNbGeoRub;\n" \
4683  " }\n" \
4684  "\n" \
4685  " for (j = 0; (j < givrListParu.iNbr && GIV::giv_RUB == iTri); j++)\n" \
4686  " {\n" \
4687  " /* restauration de iRgTriDbl */\n" \
4688  " jj = givrListParu.trEltRangList[j];\n" \
4689  "\n" \
4690  " if (-1 != givrListParu.trEltList[jj].iRgTriDbl)\n" \
4691  " ii = jj;\n" \
4692  " else\n" \
4693  " givrListParu.trEltList[jj].iRgTriDbl = givrListParu.trEltList[ii].iRgTriDbl;\n" \
4694  " }\n" \
4695  "\n" \
4696  " for (j = givrListParu.iNbr; (j < givrListParu.iNbrTot && GIV::giv_RUB == iTri); j++)\n" \
4697  " {\n" \
4698  " /* restauration de iRgTriDbl */\n" \
4699  " jj = givrListParu.trEltRangList[j];\n" \
4700  "\n" \
4701  " for (i = 0; i < givrListParu.iNbr; i++)\n" \
4702  " {\n" \
4703  " ii = givrListParu.trEltRangList[i];\n" \
4704  "\n" \
4705  " if (givrListParu.trEltList[ii].iRangTri == givrListParu.trEltList[jj].iRangTri)\n" \
4706  " {\n" \
4707  " givrListParu.trEltList[jj].iRgTriDbl = givrListParu.trEltList[ii].iRgTriDbl;\n" \
4708  " break;\n" \
4709  " }\n" \
4710  " }\n" \
4711  " }\n" \
4712  "\n" \
4713  " GWTTrace(GWT_NIV_FONCT, (\"Nb Parution [%d],[%d]\\n\", givrListParu.iNbrTot, givrListParu.iNbr));\n" \
4714  "\n" \
4715  " for (j = 0; j < (givrListParu.iNbrTot); j++)\n" \
4716  " {\n" \
4717  " i = givrListParu.trEltRangList[j];\n" \
4718  " GWTTrace(GWT_NIV_FONCT, (\"Parution [%d],[%d],[%d],[%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d],[%d],[%d],[%d]\\n\", givrListParu.trEltList[i].iRgGeoTri, givrListParu.trEltList[i].iNbGeoTri,\n" \
4719  " givrListParu.trEltList[i].iRangTri, givrListParu.trEltList[i].iRgTriDbl, givrListParu.trEltList[i].rub, givrListParu.trEltList[i].dep, givrListParu.trEltList[i].loc, givrListParu.trEltList[i].arr,\n" \
4720  " givrListParu.trEltList[i].reg, givrListParu.trEltList[i].iGeoReg, givrListParu.trEltList[i].iGeoDept, givrListParu.trEltList[i].iGeoLoc, givrListParu.trEltList[i].iGeoArr,\n" \
4721  " givrListParu.trEltList[i].iZU, givrListParu.trEltList[i].iRgLigne, givrListParu.trEltList[i].iRgObj));\n" \
4722  " }\n" \
4723  "\n" \
4724  " GWTTrace(GWT_NIV_FONCT, (\"Nb Installation [%d],[%d]\\n\", givrListInst.iNbrTot, givrListInst.iNbr));\n" \
4725  "\n" \
4726  " for (j = 0; j < (givrListInst.iNbrTot); j++)\n" \
4727  " {\n" \
4728  " i = givrListInst.trEltRangList[j];\n" \
4729  " GWTTrace(GWT_NIV_FONCT, (\"Installation [%d],[%d],[%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d]\\n\", givrListInst.trEltList[i].iRgGeoTri, givrListInst.trEltList[i].iNbGeoTri,\n" \
4730  " givrListInst.trEltList[i].iRangTri, givrListInst.trEltList[i].rub, givrListInst.trEltList[i].dep, givrListInst.trEltList[i].loc, givrListInst.trEltList[i].arr, givrListInst.trEltList[i].reg,\n" \
4731  " givrListInst.trEltList[i].iGeoReg, givrListInst.trEltList[i].iGeoDept, givrListInst.trEltList[i].iGeoLoc, givrListInst.trEltList[i].iGeoArr));\n" \
4732  " }\n" \
4733  "\n" \
4734  " /* Retourner sans erreur */\n" \
4735  " return (iCodRet);\n" \
4736  "}\n" \
4737  "\n" \
4738  "int4 givPreparerRequetesIeBloc()\n" \
4739  "{\n" \
4740  " int4 iCodRet = (int4)GIV::GIXCodeOK; /* Code retour de la fonction */\n" \
4741  " int4 iIntRet = (int4)GIV::GIXCodeOK; /* Code retour des appels internes */\n" \
4742  " EXEC SQL\n" \
4743  " begin declare\n" \
4744  " section;\n" \
4745  " char tcRequete[1024];\n" \
4746  " EXEC SQL\n" \
4747  " end declare\n" \
4748  " section;\n" \
4749  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
4750  "\n" \
4751  " if ((int4)GIV::GWCCodeOK != iDejaPrepare)\n" \
4752  " {\n" \
4753  " /* suppressions */\n" \
4754  " (void)sprintf(tcRequete, GIV_DEL_IEBLOC, GIXcNomDest);\n" \
4755  " EXEC SQL\n" \
4756  " prepare rqtDelIeBloc\n" \
4757  " from: tcRequete;\n" \
4758  " (void)sprintf(tcRequete, GIV_DEL_IEBLOC_CRC, GIXcNomDest);\n" \
4759  " EXEC SQL\n" \
4760  " prepare rqtDelIeBlocCRC\n" \
4761  " from: tcRequete;\n" \
4762  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
4763  " }\n" \
4764  "\n" \
4765  " /* Sortie de la fonction */\n" \
4766  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerRequetesIeBloc\\n\"));\n" \
4767  " return (iCodRet);\n" \
4768  "}\n" \
4769  "\n" \
4770  "/*----Fonction----------------------------------------------------------------*/\n" \
4771  "/* */\n" \
4772  "/* Fonction : givPreparerLecturePELREP () */\n" \
4773  "/* */\n" \
4774  "/* But : Preparation de la requete SQL de recherche du libelle de */\n" \
4775  "/* localite a partir du code localite dans la table GYTtabPelrep */\n" \
4776  "/* */\n" \
4777  "/* */\n" \
4778  "/* Entree(s) : */\n" \
4779  "/* */\n" \
4780  "/* Sortie(s) : OK ou KO */\n" \
4781  "/* */\n" \
4782  "/* Portable : Transparent */\n" \
4783  "/* */\n" \
4784  "/*----------------------------------------------------------------------------*/\n" \
4785  "\n" \
4786  "extern int4 givPreparerLectureLocAtt(void)\n" \
4787  "\n" \
4788  "{\n" \
4789  " int4 iCodRet; /* Code retour de la fonction */\n" \
4790  " int4 iIntRet; /* Code retour interne */\n" \
4791  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
4792  " int4 iLgBuffer;\n" \
4793  " int4 iLgRequete;\n" \
4794  " EXEC SQL\n" \
4795  " begin declare\n" \
4796  " section;\n" \
4797  " char cRequete[giv_LG_REQUETE];\n" \
4798  " EXEC SQL\n" \
4799  " end declare\n" \
4800  " section;\n" \
4801  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureLocAtt\\n\"));\n" \
4802  " /* Initialisation des variables locales */\n" \
4803  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
4804  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
4805  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
4806  " /* Controle de la longueur du texte de la requete */\n" \
4807  " iLgRequete = strlen(GIV_RQ_SELECT_LIB_LJLORN);\n" \
4808  " iLgBuffer = sizeof(cRequete);\n" \
4809  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
4810  "\n" \
4811  " if (iLgBuffer <= iLgRequete)\n" \
4812  " {\n" \
4813  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
4814  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
4815  " }\n" \
4816  "\n" \
4817  " /* Construction du texte de la requete */\n" \
4818  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
4819  " {\n" \
4820  " (void)sprintf(cRequete,\n" \
4821  " GIV_RQ_SELECT_LIB_LJLORN);\n" \
4822  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
4823  " /* Controle et parsing de la requete SQL */\n" \
4824  " EXEC SQL\n" \
4825  " prepare rqtLectureLocAtt\n" \
4826  " from: cRequete;\n" \
4827  " /* Traitement des erreurs SQL */\n" \
4828  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureLocAtt\");\n" \
4829  " iIntRet = GYBErreur(&vErreurSQL);\n" \
4830  "\n" \
4831  " if ((int4)GIV::GYBok != iIntRet)\n" \
4832  " {\n" \
4833  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureLocAtt : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
4834  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
4835  " }\n" \
4836  " else\n" \
4837  " {\n" \
4838  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
4839  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureLocAtt\");\n" \
4840  " EXEC SQL\n" \
4841  " declare crsLectureLocAtt\n" \
4842  " cursor\n" \
4843  " for rqtLectureLocAtt;\n" \
4844  " iIntRet = GYBErreur(&vErreurSQL);\n" \
4845  "\n" \
4846  " if ((int4)GIV::GYBok != iIntRet)\n" \
4847  " {\n" \
4848  " /* Erreur sur declaration curseur SQL */\n" \
4849  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureLocAtt ...\\n\"));\n" \
4850  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
4851  " }\n" \
4852  " }\n" \
4853  " }\n" \
4854  "\n" \
4855  " /* Controle de la longueur du texte de la requete */\n" \
4856  " iLgRequete = strlen(GIV_RQ_SELECT_LOC_DEP);\n" \
4857  " iLgBuffer = sizeof(cRequete);\n" \
4858  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
4859  "\n" \
4860  " if (iLgBuffer <= iLgRequete)\n" \
4861  " {\n" \
4862  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
4863  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
4864  " }\n" \
4865  "\n" \
4866  " /* Construction du texte de la requete */\n" \
4867  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
4868  " {\n" \
4869  " (void)sprintf(cRequete,\n" \
4870  " GIV_RQ_SELECT_LOC_DEP);\n" \
4871  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
4872  " /* Controle et parsing de la requete SQL */\n" \
4873  " EXEC SQL\n" \
4874  " prepare rqtLectureLocDep\n" \
4875  " from: cRequete;\n" \
4876  " /* Traitement des erreurs SQL */\n" \
4877  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureLocDep\");\n" \
4878  " iIntRet = GYBErreur(&vErreurSQL);\n" \
4879  "\n" \
4880  " if ((int4)GIV::GYBok != iIntRet)\n" \
4881  " {\n" \
4882  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureLocDep : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
4883  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
4884  " }\n" \
4885  " else\n" \
4886  " {\n" \
4887  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
4888  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureLocDep\");\n" \
4889  " EXEC SQL\n" \
4890  " declare crsLectureLocDep\n" \
4891  " cursor\n" \
4892  " for rqtLectureLocDep;\n" \
4893  " iIntRet = GYBErreur(&vErreurSQL);\n" \
4894  "\n" \
4895  " if ((int4)GIV::GYBok != iIntRet)\n" \
4896  " {\n" \
4897  " /* Erreur sur declaration curseur SQL */\n" \
4898  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureLocDep ...\\n\"));\n" \
4899  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
4900  " }\n" \
4901  " }\n" \
4902  " }\n" \
4903  "\n" \
4904  " /* Sortie de la fonction */\n" \
4905  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureLocAtt\\n\"));\n" \
4906  " return (iCodRet);\n" \
4907  "}\n" \
4908  "\n" \
4909  "/*----Fonction----------------------------------------------------------------*/\n" \
4910  "/* */\n" \
4911  "/* Fonction : givPreparerLectureTypeURL () */\n" \
4912  "/* */\n" \
4913  "/* But : Preparation de la requete SQL de recherche du type de */\n" \
4914  "/* l'URL a partir du numero d'objet dans la table GYTtabPemicURL */\n" \
4915  "/* */\n" \
4916  "/* */\n" \
4917  "/* Entree(s) : */\n" \
4918  "/* */\n" \
4919  "/* Sortie(s) : OK ou KO */\n" \
4920  "/* */\n" \
4921  "/* Portable : Transparent */\n" \
4922  "/* */\n" \
4923  "/*----------------------------------------------------------------------------*/\n" \
4924  "\n" \
4925  "extern int4 givPreparerLectureTypeURL(void)\n" \
4926  "\n" \
4927  "{\n" \
4928  " int4 iCodRet; /* Code retour de la fonction */\n" \
4929  " int4 iIntRet; /* Code retour interne */\n" \
4930  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
4931  " int4 iLgBuffer;\n" \
4932  " int4 iLgRequete;\n" \
4933  " EXEC SQL\n" \
4934  " begin declare\n" \
4935  " section;\n" \
4936  " char cRequete[giv_LG_REQUETE];\n" \
4937  " EXEC SQL\n" \
4938  " end declare\n" \
4939  " section;\n" \
4940  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureTypeURL\\n\"));\n" \
4941  " /* Initialisation des variables locales */\n" \
4942  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
4943  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
4944  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
4945  " /* Controle de la longueur du texte de la requete */\n" \
4946  " iLgRequete = strlen(GIV_RQ_SELECT_TYPE_URL);\n" \
4947  " iLgBuffer = sizeof(cRequete);\n" \
4948  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
4949  "\n" \
4950  " if (iLgBuffer <= iLgRequete)\n" \
4951  " {\n" \
4952  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
4953  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
4954  " }\n" \
4955  "\n" \
4956  " /* Construction du texte de la requete */\n" \
4957  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
4958  " {\n" \
4959  " (void)sprintf(cRequete,\n" \
4960  " GIV_RQ_SELECT_TYPE_URL);\n" \
4961  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
4962  " /* Controle et parsing de la requete SQL */\n" \
4963  " EXEC SQL\n" \
4964  " prepare rqtLectureTypeURL\n" \
4965  " from: cRequete;\n" \
4966  " /* Traitement des erreurs SQL */\n" \
4967  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureTypeURL\");\n" \
4968  " iIntRet = GYBErreur(&vErreurSQL);\n" \
4969  "\n" \
4970  " if ((int4)GIV::GYBok != iIntRet)\n" \
4971  " {\n" \
4972  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureTypeURL : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
4973  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
4974  " }\n" \
4975  " else\n" \
4976  " {\n" \
4977  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
4978  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureTypeURL\");\n" \
4979  " EXEC SQL\n" \
4980  " declare crsLectureTypeURL\n" \
4981  " cursor\n" \
4982  " for rqtLectureTypeURL;\n" \
4983  " iIntRet = GYBErreur(&vErreurSQL);\n" \
4984  "\n" \
4985  " if ((int4)GIV::GYBok != iIntRet)\n" \
4986  " {\n" \
4987  " /* Erreur sur declaration curseur SQL */\n" \
4988  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureTypeURL ...\\n\"));\n" \
4989  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
4990  " }\n" \
4991  " }\n" \
4992  " }\n" \
4993  "\n" \
4994  " /* Sortie de la fonction */\n" \
4995  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureTypeURL\\n\"));\n" \
4996  " return (iCodRet);\n" \
4997  "}\n" \
4998  "\n" \
4999  "/*----Fonction----------------------------------------------------------------*/\n" \
5000  "/* */\n" \
5001  "/* Fonction : givPreparerLectureEmbauche () */\n" \
5002  "/* */\n" \
5003  "/* But : Preparation de la requete SQL de recherche de */\n" \
5004  "/* ref à partir de numcli dans la table GYTtabEmbauche */\n" \
5005  "/* */\n" \
5006  "/* Entree(s) : */\n" \
5007  "/* */\n" \
5008  "/* Sortie(s) : OK ou KO */\n" \
5009  "/* */\n" \
5010  "/* Portable : Transparent */\n" \
5011  "/* */\n" \
5012  "/*----------------------------------------------------------------------------*/\n" \
5013  "\n" \
5014  "int4 givPreparerLectureEmbauche(void)\n" \
5015  "\n" \
5016  "{\n" \
5017  " int4 iCodRet; /* Code retour de la fonction */\n" \
5018  " int4 iIntRet; /* Code retour interne */\n" \
5019  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
5020  " int4 iLgBuffer;\n" \
5021  " int4 iLgRequete;\n" \
5022  " EXEC SQL\n" \
5023  " begin declare\n" \
5024  " section;\n" \
5025  " char cRequete[giv_LG_REQUETE];\n" \
5026  " EXEC SQL\n" \
5027  " end declare\n" \
5028  " section;\n" \
5029  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureEmbauche\\n\"));\n" \
5030  " /* Initialisation des variables locales */\n" \
5031  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
5032  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
5033  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
5034  " /* Controle de la longueur du texte de la requete */\n" \
5035  " iLgRequete = strlen(GIV_RQ_SELECT_EMBAUCHE);\n" \
5036  " iLgBuffer = sizeof(cRequete);\n" \
5037  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5038  "\n" \
5039  " if (iLgBuffer <= iLgRequete)\n" \
5040  " {\n" \
5041  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5042  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5043  " }\n" \
5044  "\n" \
5045  " /* Construction du texte de la requete */\n" \
5046  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5047  " {\n" \
5048  " (void)sprintf(cRequete,\n" \
5049  " GIV_RQ_SELECT_EMBAUCHE);\n" \
5050  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5051  " /* Controle et parsing de la requete SQL */\n" \
5052  " EXEC SQL\n" \
5053  " prepare rqtLectureEmbauche\n" \
5054  " from: cRequete;\n" \
5055  " /* Traitement des erreurs SQL */\n" \
5056  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureEmbauche\");\n" \
5057  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5058  "\n" \
5059  " if ((int4)GIV::GYBok != iIntRet)\n" \
5060  " {\n" \
5061  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureEmbauche : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5062  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5063  " }\n" \
5064  " else\n" \
5065  " {\n" \
5066  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5067  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureEmbauche\");\n" \
5068  " EXEC SQL\n" \
5069  " declare crsLectureEmbauche\n" \
5070  " cursor\n" \
5071  " for rqtLectureEmbauche;\n" \
5072  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5073  "\n" \
5074  " if ((int4)GIV::GYBok != iIntRet)\n" \
5075  " {\n" \
5076  " /* Erreur sur declaration curseur SQL */\n" \
5077  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureEmbauche ...\\n\"));\n" \
5078  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5079  " }\n" \
5080  " }\n" \
5081  " }\n" \
5082  "\n" \
5083  " /* Sortie de la fonction */\n" \
5084  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureEmbauche\\n\"));\n" \
5085  " return (iCodRet);\n" \
5086  "}\n" \
5087  "\n" \
5088  "/*----Fonction----------------------------------------------------------------*/\n" \
5089  "/* */\n" \
5090  "/* Fonction : givPreparerLectureStat () */\n" \
5091  "/* */\n" \
5092  "/* But : Preparation de la requete SQL de recherche du */\n" \
5093  "/* code statistique de l'annonceur */\n" \
5094  "/* */\n" \
5095  "/* Entree(s) : */\n" \
5096  "/* */\n" \
5097  "/* Sortie(s) : OK ou KO */\n" \
5098  "/* */\n" \
5099  "/* Portable : Transparent */\n" \
5100  "/* */\n" \
5101  "/*----------------------------------------------------------------------------*/\n" \
5102  "\n" \
5103  "int4 givPreparerLectureStat(void)\n" \
5104  "\n" \
5105  "{\n" \
5106  " int4 iCodRet; /* Code retour de la fonction */\n" \
5107  " int4 iIntRet; /* Code retour interne */\n" \
5108  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
5109  " int4 iLgBuffer;\n" \
5110  " int4 iLgRequete;\n" \
5111  " EXEC SQL\n" \
5112  " begin declare\n" \
5113  " section;\n" \
5114  " char cRequete[giv_LG_REQUETE];\n" \
5115  " EXEC SQL\n" \
5116  " end declare\n" \
5117  " section;\n" \
5118  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureStat\\n\"));\n" \
5119  " /* Initialisation des variables locales */\n" \
5120  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
5121  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
5122  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
5123  " /* Controle de la longueur du texte de la requete */\n" \
5124  " iLgRequete = strlen(GIV_RQ_SELECT_STAT);\n" \
5125  " iLgBuffer = sizeof(cRequete);\n" \
5126  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5127  "\n" \
5128  " if (iLgBuffer <= iLgRequete)\n" \
5129  " {\n" \
5130  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5131  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5132  " }\n" \
5133  "\n" \
5134  " /* Construction du texte de la requete */\n" \
5135  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5136  " {\n" \
5137  " (void)sprintf(cRequete,\n" \
5138  " GIV_RQ_SELECT_STAT);\n" \
5139  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5140  " /* Controle et parsing de la requete SQL */\n" \
5141  " EXEC SQL\n" \
5142  " prepare rqtLectureStat\n" \
5143  " from: cRequete;\n" \
5144  " /* Traitement des erreurs SQL */\n" \
5145  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureStat\");\n" \
5146  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5147  "\n" \
5148  " if ((int4)GIV::GYBok != iIntRet)\n" \
5149  " {\n" \
5150  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureStat : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5151  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5152  " }\n" \
5153  " else\n" \
5154  " {\n" \
5155  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5156  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureStat\");\n" \
5157  " EXEC SQL\n" \
5158  " declare crsLectureStat\n" \
5159  " cursor\n" \
5160  " for rqtLectureStat;\n" \
5161  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5162  "\n" \
5163  " if ((int4)GIV::GYBok != iIntRet)\n" \
5164  " {\n" \
5165  " /* Erreur sur declaration curseur SQL */\n" \
5166  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureStat ...\\n\"));\n" \
5167  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5168  " }\n" \
5169  " }\n" \
5170  " }\n" \
5171  "\n" \
5172  " /* Sortie de la fonction */\n" \
5173  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureStat\\n\"));\n" \
5174  " return (iCodRet);\n" \
5175  "}\n" \
5176  "\n" \
5177  "/*----Fonction----------------------------------------------------------------*/\n" \
5178  "/* */\n" \
5179  "/* Fonction : givPreparerLectureImag () */\n" \
5180  "/* */\n" \
5181  "/* But : Preparation de la requete SQL de recherche du */\n" \
5182  "/* nombre d'images pour le produit PVI */\n" \
5183  "/* */\n" \
5184  "/* Entree(s) : */\n" \
5185  "/* */\n" \
5186  "/* Sortie(s) : OK ou KO */\n" \
5187  "/* */\n" \
5188  "/* Portable : Transparent */\n" \
5189  "/* */\n" \
5190  "/*----------------------------------------------------------------------------*/\n" \
5191  "\n" \
5192  "int4 givPreparerLectureImag(void)\n" \
5193  "\n" \
5194  "{\n" \
5195  " int4 iCodRet; /* Code retour de la fonction */\n" \
5196  " int4 iIntRet; /* Code retour interne */\n" \
5197  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
5198  " int4 iLgBuffer;\n" \
5199  " int4 iLgRequete;\n" \
5200  " EXEC SQL\n" \
5201  " begin declare\n" \
5202  " section;\n" \
5203  " char cRequete[giv_LG_REQUETE];\n" \
5204  " EXEC SQL\n" \
5205  " end declare\n" \
5206  " section;\n" \
5207  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureImag\\n\"));\n" \
5208  " /* Initialisation des variables locales */\n" \
5209  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
5210  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
5211  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
5212  " /* Controle de la longueur du texte de la requete */\n" \
5213  " iLgRequete = strlen(GIV_RQ_SELECT_IMAG);\n" \
5214  " iLgBuffer = sizeof(cRequete);\n" \
5215  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5216  "\n" \
5217  " if (iLgBuffer <= iLgRequete)\n" \
5218  " {\n" \
5219  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5220  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5221  " }\n" \
5222  "\n" \
5223  " /* Construction du texte de la requete */\n" \
5224  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5225  " {\n" \
5226  " (void)sprintf(cRequete,\n" \
5227  " GIV_RQ_SELECT_IMAG);\n" \
5228  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5229  " /* Controle et parsing de la requete SQL */\n" \
5230  " EXEC SQL\n" \
5231  " prepare rqtLectureImag\n" \
5232  " from: cRequete;\n" \
5233  " /* Traitement des erreurs SQL */\n" \
5234  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureImag\");\n" \
5235  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5236  "\n" \
5237  " if ((int4)GIV::GYBok != iIntRet)\n" \
5238  " {\n" \
5239  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureImag : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5240  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5241  " }\n" \
5242  " else\n" \
5243  " {\n" \
5244  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5245  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureImag\");\n" \
5246  " EXEC SQL\n" \
5247  " declare crsLectureImag\n" \
5248  " cursor\n" \
5249  " for rqtLectureImag;\n" \
5250  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5251  "\n" \
5252  " if ((int4)GIV::GYBok != iIntRet)\n" \
5253  " {\n" \
5254  " /* Erreur sur declaration curseur SQL */\n" \
5255  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureImag ...\\n\"));\n" \
5256  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5257  " }\n" \
5258  " }\n" \
5259  " }\n" \
5260  "\n" \
5261  " /* Sortie de la fonction */\n" \
5262  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureImag\\n\"));\n" \
5263  " return (iCodRet);\n" \
5264  "}\n" \
5265  "\n" \
5266  "/*----Fonction----------------------------------------------------------------*/\n" \
5267  "/* */\n" \
5268  "/* Fonction : givPreparerLectureMotsCles () */\n" \
5269  "/* */\n" \
5270  "/* But : Preparation de la requete SQL de recherche du */\n" \
5271  "/* crc mots cles */\n" \
5272  "/* */\n" \
5273  "/* Entree(s) : */\n" \
5274  "/* */\n" \
5275  "/* Sortie(s) : OK ou KO */\n" \
5276  "/* */\n" \
5277  "/* Portable : Transparent */\n" \
5278  "/* */\n" \
5279  "/*----------------------------------------------------------------------------*/\n" \
5280  "\n" \
5281  "int4 givPreparerLectureMotsCles(void)\n" \
5282  "\n" \
5283  "{\n" \
5284  " int4 iCodRet; /* Code retour de la fonction */\n" \
5285  " int4 iIntRet; /* Code retour interne */\n" \
5286  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
5287  " int4 iLgBuffer;\n" \
5288  " int4 iLgRequete;\n" \
5289  " EXEC SQL\n" \
5290  " begin declare\n" \
5291  " section;\n" \
5292  " char cRequete[giv_LG_REQUETE];\n" \
5293  " EXEC SQL\n" \
5294  " end declare\n" \
5295  " section;\n" \
5296  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureImag\\n\"));\n" \
5297  " /* Initialisation des variables locales */\n" \
5298  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
5299  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
5300  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
5301  " /* Controle de la longueur du texte de la requete */\n" \
5302  " iLgRequete = strlen(GIV_SLC_MOT_CLE);\n" \
5303  " iLgBuffer = sizeof(cRequete);\n" \
5304  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5305  "\n" \
5306  " if (iLgBuffer <= iLgRequete)\n" \
5307  " {\n" \
5308  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5309  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5310  " }\n" \
5311  "\n" \
5312  " /* Construction du texte de la requete */\n" \
5313  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5314  " {\n" \
5315  " (void)sprintf(cRequete,\n" \
5316  " GIV_SLC_MOT_CLE);\n" \
5317  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5318  " /* Controle et parsing de la requete SQL */\n" \
5319  " EXEC SQL\n" \
5320  " prepare rqtLectureMCles\n" \
5321  " from: cRequete;\n" \
5322  " /* Traitement des erreurs SQL */\n" \
5323  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureMCles\");\n" \
5324  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5325  "\n" \
5326  " if ((int4)GIV::GYBok != iIntRet)\n" \
5327  " {\n" \
5328  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureMCles : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5329  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5330  " }\n" \
5331  " else\n" \
5332  " {\n" \
5333  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5334  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureMCles\");\n" \
5335  " EXEC SQL\n" \
5336  " declare crsLectureMCles\n" \
5337  " cursor\n" \
5338  " for rqtLectureMCles;\n" \
5339  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5340  "\n" \
5341  " if ((int4)GIV::GYBok != iIntRet)\n" \
5342  " {\n" \
5343  " /* Erreur sur declaration curseur SQL */\n" \
5344  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureMCles ...\\n\"));\n" \
5345  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5346  " }\n" \
5347  " }\n" \
5348  " }\n" \
5349  "\n" \
5350  " /* Sortie de la fonction */\n" \
5351  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureMCles\\n\"));\n" \
5352  " return (iCodRet);\n" \
5353  "}\n" \
5354  "\n" \
5355  "/*----Fonction----------------------------------------------------------------*/\n" \
5356  "/* */\n" \
5357  "/* Fonction : givPreparerLectureBonPlan () */\n" \
5358  "/* */\n" \
5359  "/* But : Preparation de la requete SQL de recherche de */\n" \
5360  "/* ref à partir de etab dans la table GYTtabBonPlan */\n" \
5361  "/* */\n" \
5362  "/* Entree(s) : */\n" \
5363  "/* */\n" \
5364  "/* Sortie(s) : OK ou KO */\n" \
5365  "/* */\n" \
5366  "/* Portable : Transparent */\n" \
5367  "/* */\n" \
5368  "/*----------------------------------------------------------------------------*/\n" \
5369  "\n" \
5370  "int4 givPreparerLectureBonPlan(void)\n" \
5371  "\n" \
5372  "{\n" \
5373  " int4 iCodRet; /* Code retour de la fonction */\n" \
5374  " int4 iIntRet; /* Code retour interne */\n" \
5375  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
5376  " int4 iLgBuffer;\n" \
5377  " int4 iLgRequete;\n" \
5378  " EXEC SQL\n" \
5379  " begin declare\n" \
5380  " section;\n" \
5381  " char cRequete[giv_LG_REQUETE * 2];\n" \
5382  " EXEC SQL\n" \
5383  " end declare\n" \
5384  " section;\n" \
5385  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureBonPlan\\n\"));\n" \
5386  " /* Initialisation des variables locales */\n" \
5387  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
5388  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
5389  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
5390  " /* Controle de la longueur du texte de la requete */\n" \
5391  " iLgRequete = strlen(GIV_RQ_SELECT_BONPLAN_PUB);\n" \
5392  " iLgBuffer = sizeof(cRequete);\n" \
5393  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5394  "\n" \
5395  " if (iLgBuffer <= iLgRequete)\n" \
5396  " {\n" \
5397  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5398  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5399  " }\n" \
5400  "\n" \
5401  " /* Construction du texte de la requete */\n" \
5402  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5403  " {\n" \
5404  " (void)sprintf(cRequete,\n" \
5405  " GIV_RQ_SELECT_BONPLAN_PUB);\n" \
5406  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5407  " /* Controle et parsing de la requete SQL */\n" \
5408  " EXEC SQL\n" \
5409  " prepare rqtLectureBonPlanPub\n" \
5410  " from: cRequete;\n" \
5411  " /* Traitement des erreurs SQL */\n" \
5412  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureBonPlanPub\");\n" \
5413  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5414  "\n" \
5415  " if ((int4)GIV::GYBok != iIntRet)\n" \
5416  " {\n" \
5417  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureBonPlanPub : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5418  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5419  " }\n" \
5420  " else\n" \
5421  " {\n" \
5422  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5423  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureBonPlanPub\");\n" \
5424  " EXEC SQL\n" \
5425  " declare crsLectureBonPlanPub\n" \
5426  " cursor\n" \
5427  " for rqtLectureBonPlanPub;\n" \
5428  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5429  "\n" \
5430  " if ((int4)GIV::GYBok != iIntRet)\n" \
5431  " {\n" \
5432  " /* Erreur sur declaration curseur SQL */\n" \
5433  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureBonPlanPub ...\\n\"));\n" \
5434  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5435  " }\n" \
5436  " }\n" \
5437  " }\n" \
5438  "\n" \
5439  " /* Sortie de la fonction */\n" \
5440  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureBonPlan\\n\"));\n" \
5441  " return (iCodRet);\n" \
5442  "}\n" \
5443  "\n" \
5444  "/*----Fonction----------------------------------------------------------------*/\n" \
5445  "/* */\n" \
5446  "/* Fonction : givPreparerLectureBUC () */\n" \
5447  "/* */\n" \
5448  "/* But : Preparation de la requete SQL de recherche de */\n" \
5449  "/* numcli à partir de etab dans la table GYTtabIeInsc */\n" \
5450  "/* */\n" \
5451  "/* Entree(s) : */\n" \
5452  "/* */\n" \
5453  "/* Sortie(s) : OK ou KO */\n" \
5454  "/* */\n" \
5455  "/* Portable : Transparent */\n" \
5456  "/* */\n" \
5457  "/*----------------------------------------------------------------------------*/\n" \
5458  "\n" \
5459  "int4 givPreparerLectureBUC()\n" \
5460  "\n" \
5461  "{\n" \
5462  " int4 iCodRet; /* Code retour de la fonction */\n" \
5463  " int4 iIntRet; /* Code retour interne */\n" \
5464  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
5465  " int4 iLgBuffer;\n" \
5466  " int4 iLgRequete;\n" \
5467  " EXEC SQL\n" \
5468  " begin declare\n" \
5469  " section;\n" \
5470  " char cRequete[giv_LG_REQUETE];\n" \
5471  " EXEC SQL\n" \
5472  " end declare\n" \
5473  " section;\n" \
5474  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureBUC\\n\"));\n" \
5475  " /* Initialisation des variables locales */\n" \
5476  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
5477  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
5478  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
5479  " /* Controle de la longueur du texte de la requete */\n" \
5480  " iLgRequete = strlen(GIV_RQ_SELECT_BUC);\n" \
5481  " iLgBuffer = sizeof(cRequete);\n" \
5482  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5483  "\n" \
5484  " if (iLgBuffer <= iLgRequete)\n" \
5485  " {\n" \
5486  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5487  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5488  " }\n" \
5489  "\n" \
5490  " /* Construction du texte de la requete */\n" \
5491  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5492  " {\n" \
5493  " (void)sprintf(cRequete,\n" \
5494  " GIV_RQ_SELECT_BUC);\n" \
5495  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5496  " /* Controle et parsing de la requete SQL */\n" \
5497  " EXEC SQL\n" \
5498  " prepare rqtLectureBUC\n" \
5499  " from: cRequete;\n" \
5500  " /* Traitement des erreurs SQL */\n" \
5501  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureBUC\");\n" \
5502  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5503  "\n" \
5504  " if ((int4)GIV::GYBok != iIntRet)\n" \
5505  " {\n" \
5506  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureBUC : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5507  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5508  " }\n" \
5509  " else\n" \
5510  " {\n" \
5511  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5512  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureBUC\");\n" \
5513  " EXEC SQL\n" \
5514  " declare crsLectureBUC\n" \
5515  " cursor\n" \
5516  " for rqtLectureBUC;\n" \
5517  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5518  "\n" \
5519  " if ((int4)GIV::GYBok != iIntRet)\n" \
5520  " {\n" \
5521  " /* Erreur sur declaration curseur SQL */\n" \
5522  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureBUC ...\\n\"));\n" \
5523  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5524  " }\n" \
5525  " }\n" \
5526  " }\n" \
5527  "\n" \
5528  " /* Sortie de la fonction */\n" \
5529  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureBUC\\n\"));\n" \
5530  " return (iCodRet);\n" \
5531  "}\n" \
5532  "\n" \
5533  "/*----Fonction----------------------------------------------------------------*/\n" \
5534  "/* */\n" \
5535  "/* Fonction : givPreparerLectureSEO () */\n" \
5536  "/* */\n" \
5537  "/* But : Preparation de la requete SQL de recherche de */\n" \
5538  "/* numcli à partir de etab dans la table GYTtabIeInsc */\n" \
5539  "/* */\n" \
5540  "/* Entree(s) : */\n" \
5541  "/* */\n" \
5542  "/* Sortie(s) : OK ou KO */\n" \
5543  "/* */\n" \
5544  "/* Portable : Transparent */\n" \
5545  "/* */\n" \
5546  "/*----------------------------------------------------------------------------*/\n" \
5547  "\n" \
5548  "int4 givPreparerLectureSEO(char* apcDepart)\n" \
5549  "\n" \
5550  "{\n" \
5551  " int4 iCodRet; /* Code retour de la fonction */\n" \
5552  " int4 iIntRet; /* Code retour interne */\n" \
5553  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
5554  " int4 iLgBuffer;\n" \
5555  " int4 iLgRequete;\n" \
5556  " char conf[50];\n" \
5557  " char* pChar;\n" \
5558  " char tcClause[GWT_LG_MAX_LIGNE];\n" \
5559  " char tcBlocDoc[4]; /* destinataire bloc doc associé */\n" \
5560  " EXEC SQL begin declare section;\n" \
5561  " char cRequete[6 * giv_LG_REQUETE];\n" \
5562  " EXEC SQL end declare section;\n" \
5563  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureSEO\\n\"));\n" \
5564  " (void)sprintf(conf, \"%s_%s\", \"GIV_BLOC_DOC_EPJ\", GIXcNomDest);\n" \
5565  " iIntRet = GWTLireConf(conf, tcBlocDoc);\n" \
5566  "\n" \
5567  " if (GIV::GWTok != iIntRet)\n" \
5568  " (void)strcpy(tcBlocDoc, GIXcNomDest);\n" \
5569  "\n" \
5570  " GWTTrace(GWT_NIV_FONCT, (\"Destinataire des blocs Pertimm : %s\\n\", tcBlocDoc));\n" \
5571  " /* Préparer la requête de version */\n" \
5572  " (void)strcpy(vErreurSQL.acOrdre_sql, \"select version de bloc\");\n" \
5573  " (void)sprintf(cRequete, GIV_VERS_SEO, tcBlocDoc);\n" \
5574  "\n" \
5575  " GWTTrace(GWT_NIV_GRAVE, (\"%s\\n\", cRequete));\n" \
5576  "\n" \
5577  "\n" \
5578  " EXEC SQL prepare rqtVersSEO from: cRequete;\n" \
5579  " EXEC SQL DECLARE crsVersSEO CURSOR FOR rqtVersSEO;\n" \
5580  " /* Initialisation des variables locales */\n" \
5581  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
5582  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
5583  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
5584  " (void)sprintf(conf, \"%s_%s\", \"GIV_CLAUSE_SEO_SERVICE\", GIXcNomDest);\n" \
5585  "\n" \
5586  " if (0 != GWTLireConf(conf, &givtcClause[0]))\n" \
5587  " strcpy(givtcClause, \"\");\n" \
5588  "\n" \
5589  " pChar = &givtcClause[0];\n" \
5590  "\n" \
5591  " while (*pChar != 0)\n" \
5592  " {\n" \
5593  " if ('@' == *pChar)\n" \
5594  " *pChar = '=';\n" \
5595  "\n" \
5596  " pChar++;\n" \
5597  " }\n" \
5598  "\n" \
5599  " GWTTrace(GWT_NIV_FONCT, (\"La clause where SEO_SERVICE est : [%s],%d\\n\", givtcClause, strlen(givtcClause)));\n" \
5600  " /* Controle de la longueur du texte de la requete */\n" \
5601  " iLgRequete = strlen(GIV_RQ_SELECT_SRV_SEO) + strlen(givtcClause);\n" \
5602  " iLgBuffer = sizeof(cRequete);\n" \
5603  "\n" \
5604  " if (iLgBuffer <= iLgRequete)\n" \
5605  " {\n" \
5606  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5607  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5608  " GWTTrace(GWT_NIV_GRAVE, (\"SEO_SERVICE : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5609  " }\n" \
5610  "\n" \
5611  " /* Construction du texte de la requete */\n" \
5612  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5613  " {\n" \
5614  " (void)sprintf(cRequete,\n" \
5615  " GIV_RQ_SELECT_SRV_SEO, givtcClause);\n" \
5616  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5617  " /* Controle et parsing de la requete SQL */\n" \
5618  " EXEC SQL\n" \
5619  " prepare rqtLectureSrvSEO\n" \
5620  " from: cRequete;\n" \
5621  " /* Traitement des erreurs SQL */\n" \
5622  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureSrvSEO\");\n" \
5623  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5624  "\n" \
5625  " if ((int4)GIV::GYBok != iIntRet)\n" \
5626  " {\n" \
5627  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureSrvSEO : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5628  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5629  " }\n" \
5630  " else\n" \
5631  " {\n" \
5632  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5633  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureSrvSEO\");\n" \
5634  " EXEC SQL\n" \
5635  " declare crsLectureSrvSEO\n" \
5636  " cursor\n" \
5637  " for rqtLectureSrvSEO;\n" \
5638  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5639  "\n" \
5640  " if ((int4)GIV::GYBok != iIntRet)\n" \
5641  " {\n" \
5642  " /* Erreur sur declaration curseur SQL */\n" \
5643  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureSrvSEO ...\\n\"));\n" \
5644  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5645  " }\n" \
5646  " }\n" \
5647  " }\n" \
5648  "\n" \
5649  " /* Controle de la longueur du texte de la requete */\n" \
5650  " iLgRequete = strlen(GIV_RQ_SELECT_DNOM_PRINC);\n" \
5651  " iLgBuffer = sizeof(cRequete);\n" \
5652  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5653  "\n" \
5654  " if (iLgBuffer <= iLgRequete)\n" \
5655  " {\n" \
5656  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5657  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5658  " }\n" \
5659  "\n" \
5660  " /* Construction du texte de la requete */\n" \
5661  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5662  " {\n" \
5663  " (void)sprintf(cRequete,\n" \
5664  " GIV_RQ_SELECT_DNOM_PRINC, GIXcNomFour, GIXcNomDest, apcDepart, GIXcNomFour, GIXcNomDest, apcDepart, GIXcNomFour, GIXcNomDest, apcDepart);\n" \
5665  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5666  " /* Controle et parsing de la requete SQL */\n" \
5667  " EXEC SQL\n" \
5668  " prepare rqtLectureDnomPrinc\n" \
5669  " from: cRequete;\n" \
5670  " /* Traitement des erreurs SQL */\n" \
5671  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureDnomPrinc\");\n" \
5672  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5673  "\n" \
5674  " if ((int4)GIV::GYBok != iIntRet)\n" \
5675  " {\n" \
5676  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureDnomPrinc : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5677  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5678  " }\n" \
5679  " else\n" \
5680  " {\n" \
5681  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5682  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureDnomPrinc\");\n" \
5683  " EXEC SQL\n" \
5684  " declare crsLectureDnomPrinc\n" \
5685  " cursor\n" \
5686  " for rqtLectureDnomPrinc;\n" \
5687  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5688  "\n" \
5689  " if ((int4)GIV::GYBok != iIntRet)\n" \
5690  " {\n" \
5691  " /* Erreur sur declaration curseur SQL */\n" \
5692  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureDnomPrinc ...\\n\"));\n" \
5693  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5694  " }\n" \
5695  " }\n" \
5696  " }\n" \
5697  "\n" \
5698  " /* Sortie de la fonction */\n" \
5699  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureSEO\\n\"));\n" \
5700  " return (iCodRet);\n" \
5701  "}\n" \
5702  "\n" \
5703  "/*----Fonction----------------------------------------------------------------*/\n" \
5704  "/* */\n" \
5705  "/* Fonction : givPreparerLectureExtraLoc () */\n" \
5706  "/* */\n" \
5707  "/* But : Preparation de la requete SQL de recherche de */\n" \
5708  "/* extra loc à partir de etab dans la table GYTtabIeInsc */\n" \
5709  "/* */\n" \
5710  "/* Entree(s) : */\n" \
5711  "/* */\n" \
5712  "/* Sortie(s) : OK ou KO */\n" \
5713  "/* */\n" \
5714  "/* Portable : Transparent */\n" \
5715  "/* */\n" \
5716  "/*----------------------------------------------------------------------------*/\n" \
5717  "\n" \
5718  "int4 givPreparerLectureExtraLoc(char* apcDepart)\n" \
5719  "\n" \
5720  "{\n" \
5721  " int4 iCodRet; /* Code retour de la fonction */\n" \
5722  " int4 iIntRet; /* Code retour interne */\n" \
5723  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
5724  " int4 iLgBuffer;\n" \
5725  " int4 iLgRequete;\n" \
5726  " EXEC SQL\n" \
5727  " begin declare\n" \
5728  " section;\n" \
5729  " char cRequete[6 * giv_LG_REQUETE];\n" \
5730  " EXEC SQL\n" \
5731  " end declare\n" \
5732  " section;\n" \
5733  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureExtraLoc\\n\"));\n" \
5734  " /* Initialisation des variables locales */\n" \
5735  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
5736  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
5737  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
5738  " /* Controle de la longueur du texte de la requete */\n" \
5739  " iLgRequete = strlen(GIV_RQ_SELECT_EXTRA_LOC_IS);\n" \
5740  " iLgBuffer = sizeof(cRequete);\n" \
5741  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5742  "\n" \
5743  " if (iLgBuffer <= iLgRequete)\n" \
5744  " {\n" \
5745  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5746  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5747  " }\n" \
5748  "\n" \
5749  " /* Construction du texte de la requete */\n" \
5750  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5751  " {\n" \
5752  " (void)sprintf(cRequete,\n" \
5753  " GIV_RQ_SELECT_EXTRA_LOC_IS, GIXcNomFour, GIXcNomDest, apcDepart, GIXcNomFour, GIXcNomDest, apcDepart, GIXcNomFour, GIXcNomDest, apcDepart);\n" \
5754  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5755  " /* Controle et parsing de la requete SQL */\n" \
5756  " EXEC SQL\n" \
5757  " prepare rqtLectureExtraLocIS\n" \
5758  " from: cRequete;\n" \
5759  " /* Traitement des erreurs SQL */\n" \
5760  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureExtraLocIS\");\n" \
5761  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5762  "\n" \
5763  " if ((int4)GIV::GYBok != iIntRet)\n" \
5764  " {\n" \
5765  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureExtraLocIS : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5766  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5767  " }\n" \
5768  " else\n" \
5769  " {\n" \
5770  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5771  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureExtraLocIS\");\n" \
5772  " EXEC SQL\n" \
5773  " declare crsLectureExtraLocIS\n" \
5774  " cursor\n" \
5775  " for rqtLectureExtraLocIS;\n" \
5776  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5777  "\n" \
5778  " if ((int4)GIV::GYBok != iIntRet)\n" \
5779  " {\n" \
5780  " /* Erreur sur declaration curseur SQL */\n" \
5781  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureExtraLocIS ...\\n\"));\n" \
5782  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5783  " }\n" \
5784  " }\n" \
5785  " }\n" \
5786  "\n" \
5787  " /* Controle de la longueur du texte de la requete */\n" \
5788  " iLgRequete = strlen(GIV_RQ_SELECT_EXTRA_LOC_INTER_IS);\n" \
5789  " iLgBuffer = sizeof(cRequete);\n" \
5790  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5791  "\n" \
5792  " if (iLgBuffer <= iLgRequete)\n" \
5793  " {\n" \
5794  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5795  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5796  " }\n" \
5797  "\n" \
5798  " /* Construction du texte de la requete */\n" \
5799  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5800  " {\n" \
5801  " (void)sprintf(cRequete,\n" \
5802  " GIV_RQ_SELECT_EXTRA_LOC_INTER_IS, GIXcNomFour, GIXcNomDest, apcDepart, GIXcNomFour, GIXcNomDest, apcDepart, GIXcNomFour, GIXcNomDest, apcDepart);\n" \
5803  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5804  " /* Controle et parsing de la requete SQL */\n" \
5805  " EXEC SQL\n" \
5806  " prepare rqtLectureExtraLocInterIS\n" \
5807  " from: cRequete;\n" \
5808  " /* Traitement des erreurs SQL */\n" \
5809  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureExtraLocInterIS\");\n" \
5810  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5811  "\n" \
5812  " if ((int4)GIV::GYBok != iIntRet)\n" \
5813  " {\n" \
5814  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureExtraLocInterIS : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5815  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5816  " }\n" \
5817  " else\n" \
5818  " {\n" \
5819  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5820  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureExtraLocIS\");\n" \
5821  " EXEC SQL\n" \
5822  " declare crsLectureExtraLocInterIS\n" \
5823  " cursor\n" \
5824  " for rqtLectureExtraLocInterIS;\n" \
5825  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5826  "\n" \
5827  " if ((int4)GIV::GYBok != iIntRet)\n" \
5828  " {\n" \
5829  " /* Erreur sur declaration curseur SQL */\n" \
5830  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureExtraLocInterIS ...\\n\"));\n" \
5831  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5832  " }\n" \
5833  " }\n" \
5834  " }\n" \
5835  "\n" \
5836  " /* Controle de la longueur du texte de la requete */\n" \
5837  " iLgRequete = strlen(GIV_RQ_SELECT_EXTRA_LOC_IO);\n" \
5838  " iLgBuffer = sizeof(cRequete);\n" \
5839  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5840  "\n" \
5841  " if (iLgBuffer <= iLgRequete)\n" \
5842  " {\n" \
5843  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5844  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5845  " }\n" \
5846  "\n" \
5847  " /* Construction du texte de la requete */\n" \
5848  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5849  " {\n" \
5850  " (void)sprintf(cRequete,\n" \
5851  " GIV_RQ_SELECT_EXTRA_LOC_IO, GIXcNomFour, GIXcNomDest, apcDepart, GIXcNomFour, GIXcNomDest, apcDepart, GIXcNomFour, GIXcNomDest, apcDepart, GIXcNomFour, GIXcNomDest, apcDepart, GIXcNomFour,\n" \
5852  " GIXcNomDest, apcDepart);\n" \
5853  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5854  " /* Controle et parsing de la requete SQL */\n" \
5855  " EXEC SQL\n" \
5856  " prepare rqtLectureExtraLocIO\n" \
5857  " from: cRequete;\n" \
5858  " /* Traitement des erreurs SQL */\n" \
5859  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureExtraLocIO\");\n" \
5860  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5861  "\n" \
5862  " if ((int4)GIV::GYBok != iIntRet)\n" \
5863  " {\n" \
5864  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureExtraLocIO : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5865  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5866  " }\n" \
5867  " else\n" \
5868  " {\n" \
5869  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5870  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureExtraLocIO\");\n" \
5871  " EXEC SQL\n" \
5872  " declare crsLectureExtraLocIO\n" \
5873  " cursor\n" \
5874  " for rqtLectureExtraLocIO;\n" \
5875  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5876  "\n" \
5877  " if ((int4)GIV::GYBok != iIntRet)\n" \
5878  " {\n" \
5879  " /* Erreur sur declaration curseur SQL */\n" \
5880  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureExtraLocIO ...\\n\"));\n" \
5881  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5882  " }\n" \
5883  " }\n" \
5884  " }\n" \
5885  "\n" \
5886  " /* Sortie de la fonction */\n" \
5887  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureExtraLoc\\n\"));\n" \
5888  " return (iCodRet);\n" \
5889  "}\n" \
5890  "\n" \
5891  "/*----Fonction----------------------------------------------------------------*/\n" \
5892  "/* */\n" \
5893  "/* Fonction : givPreparerLectureEvIlo () */\n" \
5894  "/* */\n" \
5895  "/* But : Preparation de la requete SQL de recherche de */\n" \
5896  "/* ref à partir de etab dans la table GYTtabEvIlo */\n" \
5897  "/* */\n" \
5898  "/* Entree(s) : */\n" \
5899  "/* */\n" \
5900  "/* Sortie(s) : OK ou KO */\n" \
5901  "/* */\n" \
5902  "/* Portable : Transparent */\n" \
5903  "/* */\n" \
5904  "/*----------------------------------------------------------------------------*/\n" \
5905  "\n" \
5906  "int4 givPreparerLectureEvIlo(void)\n" \
5907  "\n" \
5908  "{\n" \
5909  " int4 iCodRet; /* Code retour de la fonction */\n" \
5910  " int4 iIntRet; /* Code retour interne */\n" \
5911  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
5912  " int4 iLgBuffer;\n" \
5913  " int4 iLgRequete;\n" \
5914  " EXEC SQL\n" \
5915  " begin declare\n" \
5916  " section;\n" \
5917  " char cRequete[giv_LG_REQUETE];\n" \
5918  " EXEC SQL\n" \
5919  " end declare\n" \
5920  " section;\n" \
5921  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureEvIlo\\n\"));\n" \
5922  " /* Initialisation des variables locales */\n" \
5923  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
5924  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
5925  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
5926  " /* Controle de la longueur du texte de la requete */\n" \
5927  " iLgRequete = strlen(GIV_RQ_SELECT_EVILO);\n" \
5928  " iLgBuffer = sizeof(cRequete);\n" \
5929  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
5930  "\n" \
5931  " if (iLgBuffer <= iLgRequete)\n" \
5932  " {\n" \
5933  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
5934  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5935  " }\n" \
5936  "\n" \
5937  " /* Construction du texte de la requete */\n" \
5938  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
5939  " {\n" \
5940  " (void)sprintf(cRequete,\n" \
5941  " GIV_RQ_SELECT_EVILO);\n" \
5942  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
5943  " /* Controle et parsing de la requete SQL */\n" \
5944  " EXEC SQL\n" \
5945  " prepare rqtLectureEvIlo\n" \
5946  " from: cRequete;\n" \
5947  " /* Traitement des erreurs SQL */\n" \
5948  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureEvIlo\");\n" \
5949  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5950  "\n" \
5951  " if ((int4)GIV::GYBok != iIntRet)\n" \
5952  " {\n" \
5953  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureEvIlo : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
5954  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5955  " }\n" \
5956  " else\n" \
5957  " {\n" \
5958  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
5959  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureEvIlo\");\n" \
5960  " EXEC SQL\n" \
5961  " declare crsLectureEvIlo\n" \
5962  " cursor\n" \
5963  " for rqtLectureEvIlo;\n" \
5964  " iIntRet = GYBErreur(&vErreurSQL);\n" \
5965  "\n" \
5966  " if ((int4)GIV::GYBok != iIntRet)\n" \
5967  " {\n" \
5968  " /* Erreur sur declaration curseur SQL */\n" \
5969  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureEvIlo ...\\n\"));\n" \
5970  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
5971  " }\n" \
5972  " }\n" \
5973  " }\n" \
5974  "\n" \
5975  " /* Sortie de la fonction */\n" \
5976  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureEvIlo\\n\"));\n" \
5977  " return (iCodRet);\n" \
5978  "}\n" \
5979  "\n" \
5980  "/*----Fonction----------------------------------------------------------------*/\n" \
5981  "/* */\n" \
5982  "/* Fonction : givPreparerLectureSIRET () */\n" \
5983  "/* */\n" \
5984  "/* But : Preparation de la requete SQL de recherche du type de */\n" \
5985  "/* SIRET a partir de la table GYTtabPagesPro */\n" \
5986  "/* */\n" \
5987  "/* */\n" \
5988  "/* Entree(s) : */\n" \
5989  "/* */\n" \
5990  "/* Sortie(s) : OK ou KO */\n" \
5991  "/* */\n" \
5992  "/* Portable : Transparent */\n" \
5993  "/* */\n" \
5994  "/*----------------------------------------------------------------------------*/\n" \
5995  "\n" \
5996  "extern int4 givPreparerLectureSIRET(void)\n" \
5997  "\n" \
5998  "{\n" \
5999  " int4 iCodRet; /* Code retour de la fonction */\n" \
6000  " int4 iIntRet; /* Code retour interne */\n" \
6001  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
6002  " int4 iLgBuffer;\n" \
6003  " int4 iLgRequete;\n" \
6004  " EXEC SQL\n" \
6005  " begin declare\n" \
6006  " section;\n" \
6007  " char cRequete[giv_LG_REQUETE];\n" \
6008  " EXEC SQL\n" \
6009  " end declare\n" \
6010  " section;\n" \
6011  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureSIRET\\n\"));\n" \
6012  " /* Initialisation des variables locales */\n" \
6013  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
6014  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
6015  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
6016  " /* Controle de la longueur du texte de la requete */\n" \
6017  " iLgRequete = strlen(GIV_RQ_SELECT_SIRET);\n" \
6018  " iLgBuffer = sizeof(cRequete);\n" \
6019  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6020  "\n" \
6021  " if (iLgBuffer <= iLgRequete)\n" \
6022  " {\n" \
6023  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6024  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6025  " }\n" \
6026  "\n" \
6027  " /* Construction du texte de la requete */\n" \
6028  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6029  " {\n" \
6030  " (void)sprintf(cRequete,\n" \
6031  " GIV_RQ_SELECT_SIRET);\n" \
6032  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
6033  " /* Controle et parsing de la requete SQL */\n" \
6034  " EXEC SQL\n" \
6035  " prepare rqtLectureSIRET\n" \
6036  " from: cRequete;\n" \
6037  " /* Traitement des erreurs SQL */\n" \
6038  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureSIRET\");\n" \
6039  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6040  "\n" \
6041  " if ((int4)GIV::GYBok != iIntRet)\n" \
6042  " {\n" \
6043  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureSIRET : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6044  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6045  " }\n" \
6046  " else\n" \
6047  " {\n" \
6048  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6049  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureSIRET\");\n" \
6050  " EXEC SQL\n" \
6051  " declare crsLectureSIRET\n" \
6052  " cursor\n" \
6053  " for rqtLectureSIRET;\n" \
6054  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6055  "\n" \
6056  " if ((int4)GIV::GYBok != iIntRet)\n" \
6057  " {\n" \
6058  " /* Erreur sur declaration curseur SQL */\n" \
6059  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureSIRET ...\\n\"));\n" \
6060  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6061  " }\n" \
6062  " }\n" \
6063  " }\n" \
6064  "\n" \
6065  " /* Sortie de la fonction */\n" \
6066  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureSIRET\\n\"));\n" \
6067  " return (iCodRet);\n" \
6068  "}\n" \
6069  "\n" \
6070  "/*----Fonction----------------------------------------------------------------*/\n" \
6071  "/* */\n" \
6072  "/* Fonction : givPreparerLectureOppositionPart () */\n" \
6073  "/* */\n" \
6074  "/* But : Preparation de la requete SQL de recherche de */\n" \
6075  "/* l'opposition à partir du partenaire dans table GYTtabOppPart */\n" \
6076  "/* */\n" \
6077  "/* Entree(s) : */\n" \
6078  "/* */\n" \
6079  "/* Sortie(s) : OK ou KO */\n" \
6080  "/* */\n" \
6081  "/* Portable : Transparent */\n" \
6082  "/* */\n" \
6083  "/*----------------------------------------------------------------------------*/\n" \
6084  "\n" \
6085  "int4 givPreparerLectureOppositionPart(void)\n" \
6086  "\n" \
6087  "{\n" \
6088  " int4 iCodRet; /* Code retour de la fonction */\n" \
6089  " int4 iIntRet; /* Code retour interne */\n" \
6090  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
6091  " int4 iLgBuffer;\n" \
6092  " int4 iLgRequete;\n" \
6093  " EXEC SQL\n" \
6094  " begin declare\n" \
6095  " section;\n" \
6096  " char cRequete[giv_LG_REQUETE];\n" \
6097  " EXEC SQL\n" \
6098  " end declare\n" \
6099  " section;\n" \
6100  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureOppositionPart\\n\"));\n" \
6101  " /* Initialisation des variables locales */\n" \
6102  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
6103  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
6104  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
6105  " /* Controle de la longueur du texte de la requete */\n" \
6106  " iLgRequete = strlen(GIV_RQ_SELECT_OPP_PART);\n" \
6107  " iLgBuffer = sizeof(cRequete);\n" \
6108  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6109  "\n" \
6110  " if (iLgBuffer <= iLgRequete)\n" \
6111  " {\n" \
6112  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6113  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6114  " }\n" \
6115  "\n" \
6116  " /* Construction du texte de la requete */\n" \
6117  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6118  " {\n" \
6119  " (void)sprintf(cRequete,\n" \
6120  " GIV_RQ_SELECT_OPP_PART);\n" \
6121  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
6122  " /* Controle et parsing de la requete SQL */\n" \
6123  " EXEC SQL\n" \
6124  " prepare rqtLectureOppPart\n" \
6125  " from: cRequete;\n" \
6126  " /* Traitement des erreurs SQL */\n" \
6127  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureOppositionPart\");\n" \
6128  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6129  "\n" \
6130  " if ((int4)GIV::GYBok != iIntRet)\n" \
6131  " {\n" \
6132  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureOppositionPart : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6133  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6134  " }\n" \
6135  " else\n" \
6136  " {\n" \
6137  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6138  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureOppositionPart\");\n" \
6139  " EXEC SQL\n" \
6140  " declare crsLectureOppPart\n" \
6141  " cursor\n" \
6142  " for rqtLectureOppPart;\n" \
6143  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6144  "\n" \
6145  " if ((int4)GIV::GYBok != iIntRet)\n" \
6146  " {\n" \
6147  " /* Erreur sur declaration curseur SQL */\n" \
6148  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureOppPart ...\\n\"));\n" \
6149  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6150  " }\n" \
6151  " }\n" \
6152  " }\n" \
6153  "\n" \
6154  " /* Sortie de la fonction */\n" \
6155  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureOppositionPart\\n\"));\n" \
6156  " return (iCodRet);\n" \
6157  "}\n" \
6158  "\n" \
6159  "/*----Fonction----------------------------------------------------------------*/\n" \
6160  "/* */\n" \
6161  "/* Fonction : givPreparerLectureOppositionsURLGratuite () */\n" \
6162  "/* */\n" \
6163  "/* But : Preparation de la requete SQL de recherche de */\n" \
6164  "/* l'opposition dans tables GYTTabURLGrOpp et GYTTabURLGrProf */\n" \
6165  "/* pour les contenus de type GS */\n" \
6166  "/* */\n" \
6167  "/* Entree(s) : */\n" \
6168  "/* */\n" \
6169  "/* Sortie(s) : OK ou KO */\n" \
6170  "/* */\n" \
6171  "/* Portable : Transparent */\n" \
6172  "/* */\n" \
6173  "/*----------------------------------------------------------------------------*/\n" \
6174  "\n" \
6175  "int4 givPreparerLectureOppositionsURLGratuite(void)\n" \
6176  "\n" \
6177  "{\n" \
6178  " int4 iCodRet; /* Code retour de la fonction */\n" \
6179  " int4 iIntRet; /* Code retour interne */\n" \
6180  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
6181  " int4 iLgBuffer;\n" \
6182  " int4 iLgRequete;\n" \
6183  " EXEC SQL\n" \
6184  " begin declare\n" \
6185  " section;\n" \
6186  " char cRequete[giv_LG_REQUETE];\n" \
6187  " EXEC SQL\n" \
6188  " end declare\n" \
6189  " section;\n" \
6190  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureOppositionsURLGratuite\\n\"));\n" \
6191  " /* Initialisation des variables locales */\n" \
6192  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
6193  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
6194  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
6195  " /* Controle de la longueur du texte de la requete */\n" \
6196  " iLgRequete = strlen(GIV_RQ_SELECT_OPP_URLGR);\n" \
6197  " iLgBuffer = sizeof(cRequete);\n" \
6198  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6199  "\n" \
6200  " if (iLgBuffer <= iLgRequete)\n" \
6201  " {\n" \
6202  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6203  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6204  " }\n" \
6205  "\n" \
6206  " /* Construction du texte de la requete */\n" \
6207  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6208  " {\n" \
6209  " (void)sprintf(cRequete,\n" \
6210  " GIV_RQ_SELECT_OPP_URLGR);\n" \
6211  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
6212  " /* Controle et parsing de la requete SQL */\n" \
6213  " EXEC SQL\n" \
6214  " prepare rqtLectureOppURLGr\n" \
6215  " from: cRequete;\n" \
6216  " /* Traitement des erreurs SQL */\n" \
6217  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureOppURLGr\");\n" \
6218  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6219  "\n" \
6220  " if ((int4)GIV::GYBok != iIntRet)\n" \
6221  " {\n" \
6222  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureOppURLGr : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6223  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6224  " }\n" \
6225  " else\n" \
6226  " {\n" \
6227  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6228  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureOppURLGr\");\n" \
6229  " EXEC SQL\n" \
6230  " declare crsLectureOppURLGr\n" \
6231  " cursor\n" \
6232  " for rqtLectureOppURLGr;\n" \
6233  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6234  "\n" \
6235  " if ((int4)GIV::GYBok != iIntRet)\n" \
6236  " {\n" \
6237  " /* Erreur sur declaration curseur SQL */\n" \
6238  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureOppURLGr ...\\n\"));\n" \
6239  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6240  " }\n" \
6241  " }\n" \
6242  " }\n" \
6243  "\n" \
6244  " /* Controle de la longueur du texte de la requete */\n" \
6245  " iLgRequete = strlen(GIV_RQ_SELECT_PROF_URLGR);\n" \
6246  " iLgBuffer = sizeof(cRequete);\n" \
6247  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6248  "\n" \
6249  " if (iLgBuffer <= iLgRequete)\n" \
6250  " {\n" \
6251  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6252  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6253  " }\n" \
6254  "\n" \
6255  " /* Construction du texte de la requete */\n" \
6256  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6257  " {\n" \
6258  " (void)sprintf(cRequete,\n" \
6259  " GIV_RQ_SELECT_PROF_URLGR);\n" \
6260  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
6261  " /* Controle et parsing de la requete SQL */\n" \
6262  " EXEC SQL\n" \
6263  " prepare rqtLectureProfURLGr\n" \
6264  " from: cRequete;\n" \
6265  " /* Traitement des erreurs SQL */\n" \
6266  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureProfURLGr\");\n" \
6267  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6268  "\n" \
6269  " if ((int4)GIV::GYBok != iIntRet)\n" \
6270  " {\n" \
6271  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureProfURLGr : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6272  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6273  " }\n" \
6274  " else\n" \
6275  " {\n" \
6276  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6277  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureProfURLGr\");\n" \
6278  " EXEC SQL\n" \
6279  " declare crsLectureProfURLGr\n" \
6280  " cursor\n" \
6281  " for rqtLectureProfURLGr;\n" \
6282  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6283  "\n" \
6284  " if ((int4)GIV::GYBok != iIntRet)\n" \
6285  " {\n" \
6286  " /* Erreur sur declaration curseur SQL */\n" \
6287  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureProfURLGr ...\\n\"));\n" \
6288  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6289  " }\n" \
6290  " }\n" \
6291  " }\n" \
6292  "\n" \
6293  " /* Sortie de la fonction */\n" \
6294  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureOppositionsURLGratuite\\n\"));\n" \
6295  " return (iCodRet);\n" \
6296  "}\n" \
6297  "\n" \
6298  "/*----Fonction----------------------------------------------------------------*/\n" \
6299  "/* */\n" \
6300  "/* Fonction : givPreparerLecturePrioProfCRC () */\n" \
6301  "/* */\n" \
6302  "/* But : Preparation de la requete SQL de recherche de */\n" \
6303  "/* priorité selon CRC et An8 dans table GYTTabCRCProfPrio */\n" \
6304  "/* pour les contenus */\n" \
6305  "/* */\n" \
6306  "/* Entree(s) : */\n" \
6307  "/* */\n" \
6308  "/* Sortie(s) : OK ou KO */\n" \
6309  "/* */\n" \
6310  "/* Portable : Transparent */\n" \
6311  "/* */\n" \
6312  "/*----------------------------------------------------------------------------*/\n" \
6313  "\n" \
6314  "int4 givPreparerLecturePrioProfCRC(void)\n" \
6315  "\n" \
6316  "{\n" \
6317  " int4 iCodRet; /* Code retour de la fonction */\n" \
6318  " int4 iIntRet; /* Code retour interne */\n" \
6319  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
6320  " int4 iLgBuffer;\n" \
6321  " int4 iLgRequete;\n" \
6322  " EXEC SQL\n" \
6323  " begin declare\n" \
6324  " section;\n" \
6325  " char cRequete[giv_LG_REQUETE];\n" \
6326  " EXEC SQL\n" \
6327  " end declare\n" \
6328  " section;\n" \
6329  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLecturePrioProfCRC\\n\"));\n" \
6330  " /* Initialisation des variables locales */\n" \
6331  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
6332  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
6333  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
6334  " /* Controle de la longueur du texte de la requete */\n" \
6335  " iLgRequete = strlen(GIV_RQ_SELECT_PRIO_PROF_CRC);\n" \
6336  " iLgBuffer = sizeof(cRequete);\n" \
6337  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6338  "\n" \
6339  " if (iLgBuffer <= iLgRequete)\n" \
6340  " {\n" \
6341  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6342  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6343  " }\n" \
6344  "\n" \
6345  " /* Construction du texte de la requete */\n" \
6346  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6347  " {\n" \
6348  " (void)sprintf(cRequete,\n" \
6349  " GIV_RQ_SELECT_PRIO_PROF_CRC);\n" \
6350  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
6351  " /* Controle et parsing de la requete SQL */\n" \
6352  " EXEC SQL\n" \
6353  " prepare rqtLecturePrioProfCRC\n" \
6354  " from: cRequete;\n" \
6355  " /* Traitement des erreurs SQL */\n" \
6356  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLecturePrioProfCRC\");\n" \
6357  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6358  "\n" \
6359  " if ((int4)GIV::GYBok != iIntRet)\n" \
6360  " {\n" \
6361  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLecturePrioProfCRC : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6362  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6363  " }\n" \
6364  " else\n" \
6365  " {\n" \
6366  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6367  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLecturePrioProfCRC\");\n" \
6368  " EXEC SQL\n" \
6369  " declare crsLecturePrioProfCRC\n" \
6370  " cursor\n" \
6371  " for rqtLecturePrioProfCRC;\n" \
6372  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6373  "\n" \
6374  " if ((int4)GIV::GYBok != iIntRet)\n" \
6375  " {\n" \
6376  " /* Erreur sur declaration curseur SQL */\n" \
6377  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLecturePrioProfCRC ...\\n\"));\n" \
6378  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6379  " }\n" \
6380  " }\n" \
6381  " }\n" \
6382  "\n" \
6383  " /* Controle de la longueur du texte de la requete */\n" \
6384  " iLgRequete = strlen(GIV_RQ_SELECT_BL_CRC_LR);\n" \
6385  " iLgBuffer = sizeof(cRequete);\n" \
6386  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6387  "\n" \
6388  " if (iLgBuffer <= iLgRequete)\n" \
6389  " {\n" \
6390  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6391  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6392  " }\n" \
6393  "\n" \
6394  " /* Construction du texte de la requete */\n" \
6395  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6396  " {\n" \
6397  " (void)sprintf(cRequete,\n" \
6398  " GIV_RQ_SELECT_BL_CRC_LR);\n" \
6399  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
6400  " /* Controle et parsing de la requete SQL */\n" \
6401  " EXEC SQL\n" \
6402  " prepare rqtLectureBLCRCLR\n" \
6403  " from: cRequete;\n" \
6404  " /* Traitement des erreurs SQL */\n" \
6405  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureBLCRCLR\");\n" \
6406  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6407  "\n" \
6408  " if ((int4)GIV::GYBok != iIntRet)\n" \
6409  " {\n" \
6410  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureBLCRCLR : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6411  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6412  " }\n" \
6413  " else\n" \
6414  " {\n" \
6415  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6416  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureBLCRCLR\");\n" \
6417  " EXEC SQL\n" \
6418  " declare crsLectureBLCRCLR\n" \
6419  " cursor\n" \
6420  " for rqtLectureBLCRCLR;\n" \
6421  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6422  "\n" \
6423  " if ((int4)GIV::GYBok != iIntRet)\n" \
6424  " {\n" \
6425  " /* Erreur sur declaration curseur SQL */\n" \
6426  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureBLCRCLR ...\\n\"));\n" \
6427  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6428  " }\n" \
6429  " }\n" \
6430  " }\n" \
6431  "\n" \
6432  " /* Controle de la longueur du texte de la requete */\n" \
6433  " iLgRequete = strlen(GIV_RQ_SELECT_BL_EPJ_FD);\n" \
6434  " iLgBuffer = sizeof(cRequete);\n" \
6435  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6436  "\n" \
6437  " if (iLgBuffer <= iLgRequete)\n" \
6438  " {\n" \
6439  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6440  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6441  " }\n" \
6442  "\n" \
6443  " /* Construction du texte de la requete */\n" \
6444  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6445  " {\n" \
6446  " (void)sprintf(cRequete,\n" \
6447  " GIV_RQ_SELECT_BL_EPJ_FD);\n" \
6448  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
6449  " /* Controle et parsing de la requete SQL */\n" \
6450  " EXEC SQL\n" \
6451  " prepare rqtLectureBLEPJFD\n" \
6452  " from: cRequete;\n" \
6453  " /* Traitement des erreurs SQL */\n" \
6454  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureBLEPJFD\");\n" \
6455  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6456  "\n" \
6457  " if ((int4)GIV::GYBok != iIntRet)\n" \
6458  " {\n" \
6459  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureBLEPJFD : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6460  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6461  " }\n" \
6462  " else\n" \
6463  " {\n" \
6464  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6465  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureBLEPJFD\");\n" \
6466  " EXEC SQL\n" \
6467  " declare crsLectureBLEPJFD\n" \
6468  " cursor\n" \
6469  " for rqtLectureBLEPJFD;\n" \
6470  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6471  "\n" \
6472  " if ((int4)GIV::GYBok != iIntRet)\n" \
6473  " {\n" \
6474  " /* Erreur sur declaration curseur SQL */\n" \
6475  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureBLEPJFD ...\\n\"));\n" \
6476  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6477  " }\n" \
6478  " }\n" \
6479  " }\n" \
6480  "\n" \
6481  " /* Controle de la longueur du texte de la requete */\n" \
6482  " iLgRequete = strlen(GIV_RQ_SELECT_BL_CRC_FD);\n" \
6483  " iLgBuffer = sizeof(cRequete);\n" \
6484  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6485  "\n" \
6486  " if (iLgBuffer <= iLgRequete)\n" \
6487  " {\n" \
6488  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6489  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6490  " }\n" \
6491  "\n" \
6492  " /* Construction du texte de la requete */\n" \
6493  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6494  " {\n" \
6495  " (void)sprintf(cRequete,\n" \
6496  " GIV_RQ_SELECT_BL_CRC_FD);\n" \
6497  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
6498  " /* Controle et parsing de la requete SQL */\n" \
6499  " EXEC SQL\n" \
6500  " prepare rqtLectureBLCRCFD\n" \
6501  " from: cRequete;\n" \
6502  " /* Traitement des erreurs SQL */\n" \
6503  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureBLCRCFD\");\n" \
6504  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6505  "\n" \
6506  " if ((int4)GIV::GYBok != iIntRet)\n" \
6507  " {\n" \
6508  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureBLCRCFD : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6509  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6510  " }\n" \
6511  " else\n" \
6512  " {\n" \
6513  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6514  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureBLCRCFD\");\n" \
6515  " EXEC SQL\n" \
6516  " declare crsLectureBLCRCFD\n" \
6517  " cursor\n" \
6518  " for rqtLectureBLCRCFD;\n" \
6519  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6520  "\n" \
6521  " if ((int4)GIV::GYBok != iIntRet)\n" \
6522  " {\n" \
6523  " /* Erreur sur declaration curseur SQL */\n" \
6524  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureBLCRCFD ...\\n\"));\n" \
6525  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6526  " }\n" \
6527  " }\n" \
6528  " }\n" \
6529  "\n" \
6530  " /* Controle de la longueur du texte de la requete */\n" \
6531  " iLgRequete = strlen(GIV_RQ_SELECT_BL_EPJ_PROF);\n" \
6532  " iLgBuffer = sizeof(cRequete);\n" \
6533  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6534  "\n" \
6535  " if (iLgBuffer <= iLgRequete)\n" \
6536  " {\n" \
6537  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6538  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6539  " }\n" \
6540  "\n" \
6541  " /* Construction du texte de la requete */\n" \
6542  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6543  " {\n" \
6544  " (void)sprintf(cRequete,\n" \
6545  " GIV_RQ_SELECT_BL_EPJ_PROF);\n" \
6546  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
6547  " /* Controle et parsing de la requete SQL */\n" \
6548  " EXEC SQL\n" \
6549  " prepare rqtLectureBLEPJProf\n" \
6550  " from: cRequete;\n" \
6551  " /* Traitement des erreurs SQL */\n" \
6552  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureBLEPJProf\");\n" \
6553  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6554  "\n" \
6555  " if ((int4)GIV::GYBok != iIntRet)\n" \
6556  " {\n" \
6557  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureBLEPJProf : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6558  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6559  " }\n" \
6560  " else\n" \
6561  " {\n" \
6562  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6563  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureBLEPJProf\");\n" \
6564  " EXEC SQL\n" \
6565  " declare crsLectureBLEPJProf\n" \
6566  " cursor\n" \
6567  " for rqtLectureBLEPJProf;\n" \
6568  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6569  "\n" \
6570  " if ((int4)GIV::GYBok != iIntRet)\n" \
6571  " {\n" \
6572  " /* Erreur sur declaration curseur SQL */\n" \
6573  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureBLEPJProf ...\\n\"));\n" \
6574  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6575  " }\n" \
6576  " }\n" \
6577  " }\n" \
6578  "\n" \
6579  " /* Sortie de la fonction */\n" \
6580  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLecturePrioProfCRC\\n\"));\n" \
6581  " return (iCodRet);\n" \
6582  "}\n" \
6583  "\n" \
6584  "/*----Fonction----------------------------------------------------------------*/\n" \
6585  "/* */\n" \
6586  "/* Fonction : givPreparerSynonyme () */\n" \
6587  "/* */\n" \
6588  "/* But : Preparation de la requete SQL de recherche de */\n" \
6589  "/* synomymes d'une dénomination */\n" \
6590  "/* dans la table GYTtabDenomSynonyme */\n" \
6591  "/* */\n" \
6592  "/* Entree(s) : */\n" \
6593  "/* */\n" \
6594  "/* Sortie(s) : OK ou KO */\n" \
6595  "/* */\n" \
6596  "/* Portable : Transparent */\n" \
6597  "/* */\n" \
6598  "/*----------------------------------------------------------------------------*/\n" \
6599  "\n" \
6600  "int4 givPreparerSynonyme()\n" \
6601  "\n" \
6602  "{\n" \
6603  " int4 iCodRet; /* Code retour de la fonction */\n" \
6604  " int4 iIntRet; /* Code retour interne */\n" \
6605  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
6606  " int4 iLgBuffer;\n" \
6607  " int4 iLgRequete;\n" \
6608  " EXEC SQL\n" \
6609  " begin declare\n" \
6610  " section;\n" \
6611  " char cRequete[6 * giv_LG_REQUETE];\n" \
6612  " EXEC SQL\n" \
6613  " end declare\n" \
6614  " section;\n" \
6615  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerSynonyme\\n\"));\n" \
6616  " /* Initialisation des variables locales */\n" \
6617  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
6618  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
6619  " (void)memset((void*)cRequete, 0x00, (size_t)giv_LG_REQUETE);\n" \
6620  " /* Controle de la longueur du texte de la requete */\n" \
6621  " iLgRequete = strlen(GIVRequeteSyno);\n" \
6622  " iLgBuffer = sizeof(cRequete);\n" \
6623  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6624  "\n" \
6625  " if (iLgBuffer <= iLgRequete)\n" \
6626  " {\n" \
6627  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6628  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6629  " }\n" \
6630  "\n" \
6631  " /* Construction du texte de la requete */\n" \
6632  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6633  " {\n" \
6634  " strcpy(cRequete, GIVRequeteSyno);\n" \
6635  " GWTTrace(GWT_NIV_FONCT, (\"Requete SQL Paruadr : %s\\n\", cRequete));\n" \
6636  " /* Controle et parsing de la requete SQL */\n" \
6637  " EXEC SQL\n" \
6638  " prepare rqtLectureSyno\n" \
6639  " from: cRequete;\n" \
6640  " /* Traitement des erreurs SQL */\n" \
6641  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureSyno\");\n" \
6642  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6643  "\n" \
6644  " if ((int4)GIV::GYBok != iIntRet)\n" \
6645  " {\n" \
6646  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureSyno : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6647  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6648  " }\n" \
6649  " else\n" \
6650  " {\n" \
6651  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6652  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureSyno\");\n" \
6653  " EXEC SQL\n" \
6654  " declare crsLectureSyno\n" \
6655  " cursor\n" \
6656  " for rqtLectureSyno;\n" \
6657  " iIntRet = GYBErreur(&vErreurSQL);\n" \
6658  "\n" \
6659  " if ((int4)GIV::GYBok != iIntRet)\n" \
6660  " {\n" \
6661  " /* Erreur sur declaration curseur SQL */\n" \
6662  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureSyno ...\\n\"));\n" \
6663  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6664  " }\n" \
6665  " }\n" \
6666  " }\n" \
6667  "\n" \
6668  " /* Sortie de la fonction */\n" \
6669  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerSynonyme\\n\"));\n" \
6670  " return (iCodRet);\n" \
6671  "}\n" \
6672  "\n" \
6673  "/*----Fonction----------------------------------------------------------------*/\n" \
6674  "/* */\n" \
6675  "/* Fonction : supprimer_doublon */\n" \
6676  "/* */\n" \
6677  "/* But : supprimer les doublons dans les champs de critere selection */\n" \
6678  "/* */\n" \
6679  "/* Entree(s) : le buffer */\n" \
6680  "/* */\n" \
6681  "/* Sortie(s) : le même buffer */\n" \
6682  "/* */\n" \
6683  "/*----------------------------------------------------------------------------*/\n" \
6684  "\n" \
6685  "int4 supprimer_doublon(char* liste, char delim)\n" \
6686  "{\n" \
6687  " char* pt_fin_liste;\n" \
6688  " char* pt_debut_element;\n" \
6689  " char* pt_fin_element;\n" \
6690  " char* pt_debut_doublon;\n" \
6691  " char* pt_fin_doublon;\n" \
6692  " int4 lg_element;\n" \
6693  " int4 lg_doublon;\n" \
6694  " GWTTrace(GWT_NIV_FONCT, (\"Taille buffer doublons : %d\\n\", strlen(liste)));\n" \
6695  "\n" \
6696  " if (strlen(liste) >= sizeof(buf_concat))\n" \
6697  " {\n" \
6698  " GWTTrace(GWT_NIV_GRAVE, (\"Buffer doublons : %s\\n\", liste));\n" \
6699  " GWTTrace(GWT_NIV_GRAVE, (\"Buffer doublons : %d,%s\\n\", strlen(buf_concat), buf_concat));\n" \
6700  " return (strlen(liste));\n" \
6701  " }\n" \
6702  "\n" \
6703  " pt_fin_liste = liste + strlen(liste);\n" \
6704  "\n" \
6705  " for (pt_debut_element = liste; pt_debut_element < pt_fin_liste;)\n" \
6706  " {\n" \
6707  " pt_fin_element = strchr(pt_debut_element, delim);\n" \
6708  "\n" \
6709  " if (pt_fin_element == 0)\n" \
6710  " pt_fin_element = pt_fin_liste;\n" \
6711  " else\n" \
6712  " {\n" \
6713  " lg_element = pt_fin_element - pt_debut_element;\n" \
6714  "\n" \
6715  " /* suppression des doublons */\n" \
6716  " for (pt_debut_doublon = pt_fin_element + 1; pt_debut_doublon < pt_fin_liste;)\n" \
6717  " {\n" \
6718  " pt_fin_doublon = strchr(pt_debut_doublon, delim);\n" \
6719  "\n" \
6720  " if (pt_fin_doublon == 0)\n" \
6721  " {\n" \
6722  " pt_fin_doublon = pt_fin_liste;\n" \
6723  " lg_doublon = pt_fin_doublon - pt_debut_doublon;\n" \
6724  "\n" \
6725  " /* voir s'ils sont identique */\n" \
6726  " if ((lg_doublon == lg_element) && (strncmp(pt_debut_element, pt_debut_doublon, lg_element) == 0))\n" \
6727  " {\n" \
6728  " pt_fin_liste -= pt_fin_doublon - pt_debut_doublon + 1;\n" \
6729  " *pt_fin_liste = 0;\n" \
6730  " pt_debut_doublon = pt_fin_liste;\n" \
6731  " }\n" \
6732  " else\n" \
6733  " pt_debut_doublon = pt_fin_doublon + 1;\n" \
6734  " }\n" \
6735  " else\n" \
6736  " {\n" \
6737  " /* voir s'ils sont identique */\n" \
6738  " lg_doublon = pt_fin_doublon - pt_debut_doublon;\n" \
6739  "\n" \
6740  " if ((lg_doublon == lg_element) && (strncmp(pt_debut_element, pt_debut_doublon, lg_element) == 0))\n" \
6741  " {\n" \
6742  " if (pt_fin_liste - pt_fin_doublon - 1 > 0)\n" \
6743  " memmove(pt_debut_doublon, pt_fin_doublon + 1, pt_fin_liste - pt_fin_doublon - 1);\n" \
6744  "\n" \
6745  " pt_fin_liste -= pt_fin_doublon + 1 - pt_debut_doublon;\n" \
6746  " *pt_fin_liste = 0;\n" \
6747  " }\n" \
6748  " else\n" \
6749  " pt_debut_doublon = pt_fin_doublon + 1;\n" \
6750  " }\n" \
6751  " }\n" \
6752  " }\n" \
6753  "\n" \
6754  " pt_debut_element = pt_fin_element + 1;\n" \
6755  " }\n" \
6756  "\n" \
6757  " return (pt_fin_liste - liste);\n" \
6758  "}\n" \
6759  "\n" \
6760  "/*----------------------------------Fonction----------------------------------*\n" \
6761  " * Fonction : givPreparerLectureRJRUPR\n" \
6762  " *\n" \
6763  " * But : Prépération de la requête de lecture de la table rjrupr\n" \
6764  " *\n" \
6765  " * Description :\n" \
6766  " *\n" \
6767  " *\n" \
6768  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
6769  "\n" \
6770  "int4 givPreparerLectureRJRUPR(void)\n" \
6771  "{\n" \
6772  " int4 iCodRet = 0;\n" \
6773  " int4 iIntRet = 0;\n" \
6774  " GYBrParam_erreurT vErreurSQL;\n" \
6775  " int4 iLgBuffer = 0;\n" \
6776  " int4 iLgRequete = 0;\n" \
6777  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
6778  " EXEC SQL\n" \
6779  " begin declare\n" \
6780  " section;\n" \
6781  " char cRequete[300];\n" \
6782  " EXEC SQL\n" \
6783  " end declare\n" \
6784  " section;\n" \
6785  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
6786  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
6787  " (void)memset((void*)cRequete, 0x00, (size_t)300);\n" \
6788  "\n" \
6789  " if ((int4)GIV::GWCCodeOK == iDejaPrepare)\n" \
6790  " return (iCodRet);\n" \
6791  "\n" \
6792  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
6793  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureIAPROF\\n\"));\n" \
6794  " /* Controle de la longueur du texte de la requete */\n" \
6795  " iLgRequete = strlen(GIVRequeteLectureRJRUPR);\n" \
6796  " iLgBuffer = sizeof(cRequete);\n" \
6797  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6798  "\n" \
6799  " if (iLgBuffer <= iLgRequete)\n" \
6800  " {\n" \
6801  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6802  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6803  " }\n" \
6804  "\n" \
6805  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6806  " {\n" \
6807  " strcpy(cRequete, GIVRequeteLectureRJRUPR);\n" \
6808  " GWTTrace(GWT_NIV_FONCT, (\"Requete SQL : %s\\n\", cRequete));\n" \
6809  " /* Controle et parsing de la requete SQL */\n" \
6810  " EXEC SQL\n" \
6811  " prepare rqtLectureRJRUPR\n" \
6812  " from: cRequete;\n" \
6813  " /* Traitement des erreurs SQL */\n" \
6814  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureRJRUPR\");\n" \
6815  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
6816  "\n" \
6817  " if ((int4)GIV::GYBok != iIntRet)\n" \
6818  " {\n" \
6819  " GWTTrace(GWT_NIV_FONCT, (\"Erreur prepare rqtLectureRJRUPR : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6820  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6821  " }\n" \
6822  " else\n" \
6823  " {\n" \
6824  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6825  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureRJRUPR\");\n" \
6826  " EXEC SQL\n" \
6827  " declare crsLectureRJRUPR\n" \
6828  " cursor\n" \
6829  " for rqtLectureRJRUPR;\n" \
6830  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
6831  "\n" \
6832  " if ((int4)GIV::GYBok != iIntRet)\n" \
6833  " {\n" \
6834  " /* Erreur sur declaration curseur SQL */\n" \
6835  " GWTTrace(GWT_NIV_FONCT, (\"Erreur DECLARE crsLectureRJRUPR ...\\n\"));\n" \
6836  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6837  " }\n" \
6838  " }\n" \
6839  " }\n" \
6840  "\n" \
6841  " /* Sortie de la fonction */\n" \
6842  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureIAPROF\\n\"));\n" \
6843  " return (iCodRet);\n" \
6844  "}\n" \
6845  "\n" \
6846  "/*----------------------------------Fonction----------------------------------*\n" \
6847  " * Fonction : givPreparerLectureThemeED\n" \
6848  " *\n" \
6849  " * But : Prépération de la requête de lecture de la table ThemeED\n" \
6850  " *\n" \
6851  " * Description :\n" \
6852  " *\n" \
6853  " *\n" \
6854  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
6855  "\n" \
6856  "int4 givPreparerLectureThemeED(void)\n" \
6857  "{\n" \
6858  " int4 iCodRet = 0;\n" \
6859  " int4 iIntRet = 0;\n" \
6860  " GYBrParam_erreurT vErreurSQL;\n" \
6861  " int4 iLgBuffer = 0;\n" \
6862  " int4 iLgRequete = 0;\n" \
6863  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
6864  " EXEC SQL\n" \
6865  " begin declare\n" \
6866  " section;\n" \
6867  " char cRequete[300];\n" \
6868  " EXEC SQL\n" \
6869  " end declare\n" \
6870  " section;\n" \
6871  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
6872  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
6873  " (void)memset((void*)cRequete, 0x00, (size_t)300);\n" \
6874  "\n" \
6875  " if ((int4)GIV::GWCCodeOK == iDejaPrepare)\n" \
6876  " return (iCodRet);\n" \
6877  "\n" \
6878  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
6879  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureThemeED\\n\"));\n" \
6880  " /* Controle de la longueur du texte de la requete */\n" \
6881  " iLgRequete = strlen(GIVRequeteLectureThemeED);\n" \
6882  " iLgBuffer = sizeof(cRequete);\n" \
6883  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6884  "\n" \
6885  " if (iLgBuffer <= iLgRequete)\n" \
6886  " {\n" \
6887  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6888  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6889  " }\n" \
6890  "\n" \
6891  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6892  " {\n" \
6893  " strcpy(cRequete, GIVRequeteLectureThemeED);\n" \
6894  " GWTTrace(GWT_NIV_FONCT, (\"Requete SQL : %s\\n\", cRequete));\n" \
6895  " /* Controle et parsing de la requete SQL */\n" \
6896  " EXEC SQL\n" \
6897  " prepare rqtLectureThemeED\n" \
6898  " from: cRequete;\n" \
6899  " /* Traitement des erreurs SQL */\n" \
6900  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureThemeED\");\n" \
6901  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
6902  "\n" \
6903  " if ((int4)GIV::GYBok != iIntRet)\n" \
6904  " {\n" \
6905  " GWTTrace(GWT_NIV_FONCT, (\"Erreur prepare rqtLectureThemeED : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
6906  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6907  " }\n" \
6908  " else\n" \
6909  " {\n" \
6910  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
6911  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureThemeED\");\n" \
6912  " EXEC SQL\n" \
6913  " declare crsLectureThemeED\n" \
6914  " cursor\n" \
6915  " for rqtLectureThemeED;\n" \
6916  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
6917  "\n" \
6918  " if ((int4)GIV::GYBok != iIntRet)\n" \
6919  " {\n" \
6920  " /* Erreur sur declaration curseur SQL */\n" \
6921  " GWTTrace(GWT_NIV_FONCT, (\"Erreur DECLARE crsLectureThemeED ...\\n\"));\n" \
6922  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6923  " }\n" \
6924  " }\n" \
6925  " }\n" \
6926  "\n" \
6927  " /* Sortie de la fonction */\n" \
6928  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureThemeED\\n\"));\n" \
6929  " return (iCodRet);\n" \
6930  "}\n" \
6931  "\n" \
6932  "/*----Fonction----------------------------------------------------------------*/\n" \
6933  "/* */\n" \
6934  "/* Fonction : givPreparerLectureZU () */\n" \
6935  "/* */\n" \
6936  "/* But : Preparation de la requete SQL de recherche de zone urbaine */\n" \
6937  "/* a partir des codes dep et loc dans GYTTabPelzu */\n" \
6938  "/* */\n" \
6939  "/* */\n" \
6940  "/* Entree(s) : */\n" \
6941  "/* */\n" \
6942  "/* Sortie(s) : OK ou KO */\n" \
6943  "/* */\n" \
6944  "/* Portable : Transparent */\n" \
6945  "/* */\n" \
6946  "/*----------------------------------------------------------------------------*/\n" \
6947  "\n" \
6948  "int4 givPreparerLectureZU(void)\n" \
6949  "\n" \
6950  "{\n" \
6951  " int4 iCodRet; /* Code retour de la fonction */\n" \
6952  " int4 iIntRet; /* Code retour interne */\n" \
6953  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
6954  " int4 iLgBuffer;\n" \
6955  " int4 iLgRequete;\n" \
6956  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
6957  " EXEC SQL\n" \
6958  " begin declare\n" \
6959  " section;\n" \
6960  " char cRequete[giv_LG_REQUETE];\n" \
6961  " EXEC SQL\n" \
6962  " end declare\n" \
6963  " section;\n" \
6964  " /* Initialisation des variables locales */\n" \
6965  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
6966  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
6967  " (void)memset((void*)cRequete, 0x00, sizeof(cRequete));\n" \
6968  "\n" \
6969  " if ((int4)GIV::GWCCodeOK == iDejaPrepare)\n" \
6970  " return (iCodRet);\n" \
6971  "\n" \
6972  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
6973  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureZU\\n\"));\n" \
6974  " /* Controle de la longueur du texte de la requete */\n" \
6975  " iLgRequete = strlen(GIV_RQ_SELECT_ZU);\n" \
6976  " iLgBuffer = sizeof(cRequete);\n" \
6977  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
6978  "\n" \
6979  " if (iLgBuffer <= iLgRequete)\n" \
6980  " {\n" \
6981  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
6982  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
6983  " }\n" \
6984  "\n" \
6985  " /* Construction du texte de la requete */\n" \
6986  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
6987  " {\n" \
6988  " (void)sprintf(cRequete,\n" \
6989  " GIV_RQ_SELECT_ZU);\n" \
6990  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
6991  " /* Controle et parsing de la requete SQL */\n" \
6992  " EXEC SQL\n" \
6993  " prepare rqtLectureZU\n" \
6994  " from: cRequete;\n" \
6995  " /* Traitement des erreurs SQL */\n" \
6996  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureZU\");\n" \
6997  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
6998  "\n" \
6999  " if ((int4)GIV::GYBok != iIntRet)\n" \
7000  " {\n" \
7001  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureZU : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7002  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7003  " }\n" \
7004  " else\n" \
7005  " {\n" \
7006  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
7007  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureZU\");\n" \
7008  " EXEC SQL\n" \
7009  " declare crsLectureZU\n" \
7010  " cursor\n" \
7011  " for rqtLectureZU;\n" \
7012  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7013  "\n" \
7014  " if ((int4)GIV::GYBok != iIntRet)\n" \
7015  " {\n" \
7016  " /* Erreur sur declaration curseur SQL */\n" \
7017  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureZU ...\\n\"));\n" \
7018  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7019  " }\n" \
7020  " }\n" \
7021  " }\n" \
7022  "\n" \
7023  " /* Sortie de la fonction */\n" \
7024  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureZU\\n\"));\n" \
7025  " return (iCodRet);\n" \
7026  "}\n" \
7027  "\n" \
7028  "/*----Fonction----------------------------------------------------------------*/\n" \
7029  "/* */\n" \
7030  "/* Fonction : givPreparerLectureLocFus () */\n" \
7031  "/* */\n" \
7032  "/* But : Preparation de la requete SQL de recherche de localité */\n" \
7033  "/* fusionnée à partir des codes dep et loc dans GYTTabPelFusion */\n" \
7034  "/* */\n" \
7035  "/* */\n" \
7036  "/* Entree(s) : */\n" \
7037  "/* */\n" \
7038  "/* Sortie(s) : OK ou KO */\n" \
7039  "/* */\n" \
7040  "/* Portable : Transparent */\n" \
7041  "/* */\n" \
7042  "/*----------------------------------------------------------------------------*/\n" \
7043  "\n" \
7044  "int4 givPreparerLectureLocFus(void)\n" \
7045  "\n" \
7046  "{\n" \
7047  " int4 iCodRet; /* Code retour de la fonction */\n" \
7048  " int4 iIntRet; /* Code retour interne */\n" \
7049  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
7050  " int4 iLgBuffer;\n" \
7051  " int4 iLgRequete;\n" \
7052  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
7053  " EXEC SQL\n" \
7054  " begin declare\n" \
7055  " section;\n" \
7056  " char cRequete[giv_LG_REQUETE];\n" \
7057  " EXEC SQL\n" \
7058  " end declare\n" \
7059  " section;\n" \
7060  " /* Initialisation des variables locales */\n" \
7061  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
7062  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
7063  " (void)memset((void*)cRequete, 0x00, sizeof(cRequete));\n" \
7064  "\n" \
7065  " if ((int4)GIV::GWCCodeOK == iDejaPrepare)\n" \
7066  " return (iCodRet);\n" \
7067  "\n" \
7068  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
7069  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureLocFus\\n\"));\n" \
7070  " /* Controle de la longueur du texte de la requete */\n" \
7071  " iLgRequete = strlen(GIV_RQ_SELECT_LOCFUS);\n" \
7072  " iLgBuffer = sizeof(cRequete);\n" \
7073  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
7074  "\n" \
7075  " if (iLgBuffer <= iLgRequete)\n" \
7076  " {\n" \
7077  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
7078  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7079  " }\n" \
7080  "\n" \
7081  " /* Construction du texte de la requete */\n" \
7082  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
7083  " {\n" \
7084  " (void)sprintf(cRequete,\n" \
7085  " GIV_RQ_SELECT_LOCFUS);\n" \
7086  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
7087  " /* Controle et parsing de la requete SQL */\n" \
7088  " EXEC SQL\n" \
7089  " prepare rqtLectureLocFus\n" \
7090  " from: cRequete;\n" \
7091  " /* Traitement des erreurs SQL */\n" \
7092  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureLocFus\");\n" \
7093  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7094  "\n" \
7095  " if ((int4)GIV::GYBok != iIntRet)\n" \
7096  " {\n" \
7097  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureLocFus : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7098  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7099  " }\n" \
7100  " else\n" \
7101  " {\n" \
7102  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
7103  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureLocFus\");\n" \
7104  " EXEC SQL\n" \
7105  " declare crsLectureLocFus\n" \
7106  " cursor\n" \
7107  " for rqtLectureLocFus;\n" \
7108  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7109  "\n" \
7110  " if ((int4)GIV::GYBok != iIntRet)\n" \
7111  " {\n" \
7112  " /* Erreur sur declaration curseur SQL */\n" \
7113  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureLocFus ...\\n\"));\n" \
7114  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7115  " }\n" \
7116  " }\n" \
7117  " }\n" \
7118  "\n" \
7119  " /* Sortie de la fonction */\n" \
7120  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureLocFus\\n\"));\n" \
7121  " return (iCodRet);\n" \
7122  "}\n" \
7123  "\n" \
7124  "/*----Fonction----------------------------------------------------------------*/\n" \
7125  "/* */\n" \
7126  "/* Fonction : givPreparerLectureCRC () */\n" \
7127  "/* */\n" \
7128  "/* But : Preparation de la requete SQL de recherche de CRC */\n" \
7129  "/* */\n" \
7130  "/* */\n" \
7131  "/* */\n" \
7132  "/* Entree(s) : */\n" \
7133  "/* */\n" \
7134  "/* Sortie(s) : OK ou KO */\n" \
7135  "/* */\n" \
7136  "/* Portable : Transparent */\n" \
7137  "/* */\n" \
7138  "/*----------------------------------------------------------------------------*/\n" \
7139  "\n" \
7140  "int4 givPreparerLectureCRC(void)\n" \
7141  "\n" \
7142  "{\n" \
7143  " int4 iCodRet; /* Code retour de la fonction */\n" \
7144  " int4 iIntRet; /* Code retour interne */\n" \
7145  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
7146  " int4 iLgBuffer;\n" \
7147  " int4 iLgRequete;\n" \
7148  " EXEC SQL\n" \
7149  " begin declare\n" \
7150  " section;\n" \
7151  " char cRequete[giv_LG_REQUETE];\n" \
7152  " EXEC SQL\n" \
7153  " end declare\n" \
7154  " section;\n" \
7155  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureCRC\\n\"));\n" \
7156  " /* Initialisation des variables locales */\n" \
7157  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
7158  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
7159  " (void)memset((void*)cRequete, 0x00, sizeof(cRequete));\n" \
7160  " /* Controle de la longueur du texte de la requete */\n" \
7161  " iLgRequete = strlen(GIV_RQ_SELECT_CRC);\n" \
7162  " iLgBuffer = sizeof(cRequete);\n" \
7163  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
7164  "\n" \
7165  " if (iLgBuffer <= iLgRequete)\n" \
7166  " {\n" \
7167  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
7168  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7169  " }\n" \
7170  "\n" \
7171  " /* Construction du texte de la requete */\n" \
7172  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
7173  " {\n" \
7174  " (void)sprintf(cRequete,\n" \
7175  " GIV_RQ_SELECT_CRC);\n" \
7176  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
7177  " /* Controle et parsing de la requete SQL */\n" \
7178  " EXEC SQL\n" \
7179  " prepare rqtLectureCRC\n" \
7180  " from: cRequete;\n" \
7181  " /* Traitement des erreurs SQL */\n" \
7182  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureCRC\");\n" \
7183  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7184  "\n" \
7185  " if ((int4)GIV::GYBok != iIntRet)\n" \
7186  " {\n" \
7187  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureCRC : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7188  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7189  " }\n" \
7190  " else\n" \
7191  " {\n" \
7192  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
7193  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureCRC\");\n" \
7194  " EXEC SQL\n" \
7195  " declare crsLectureCRC\n" \
7196  " cursor\n" \
7197  " for rqtLectureCRC;\n" \
7198  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7199  "\n" \
7200  " if ((int4)GIV::GYBok != iIntRet)\n" \
7201  " {\n" \
7202  " /* Erreur sur declaration curseur SQL */\n" \
7203  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureCRC ...\\n\"));\n" \
7204  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7205  " }\n" \
7206  " }\n" \
7207  " }\n" \
7208  "\n" \
7209  " /* Sortie de la fonction */\n" \
7210  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureCRC\\n\"));\n" \
7211  " return (iCodRet);\n" \
7212  "}\n" \
7213  "\n" \
7214  "/*----Fonction----------------------------------------------------------------*/\n" \
7215  "/* */\n" \
7216  "/* Fonction : givPreparerLectureRegion () */\n" \
7217  "/* */\n" \
7218  "/* But : Preparation de la requete SQL de recherche de région */\n" \
7219  "/* a partir du code dep dans LJDEPT */\n" \
7220  "/* */\n" \
7221  "/* */\n" \
7222  "/* Entree(s) : */\n" \
7223  "/* */\n" \
7224  "/* Sortie(s) : OK ou KO */\n" \
7225  "/* */\n" \
7226  "/* Portable : Transparent */\n" \
7227  "/* */\n" \
7228  "/*----------------------------------------------------------------------------*/\n" \
7229  "\n" \
7230  "int4 givPreparerLectureRegion(void)\n" \
7231  "\n" \
7232  "{\n" \
7233  " int4 iCodRet; /* Code retour de la fonction */\n" \
7234  " int4 iIntRet; /* Code retour interne */\n" \
7235  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
7236  " int4 iLgBuffer;\n" \
7237  " int4 iLgRequete;\n" \
7238  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
7239  " EXEC SQL\n" \
7240  " begin declare\n" \
7241  " section;\n" \
7242  " char cRequete[giv_LG_REQUETE];\n" \
7243  " EXEC SQL\n" \
7244  " end declare\n" \
7245  " section;\n" \
7246  " /* Initialisation des variables locales */\n" \
7247  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
7248  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
7249  " (void)memset((void*)cRequete, 0x00, sizeof(cRequete));\n" \
7250  "\n" \
7251  " if ((int4)GIV::GWCCodeOK == iDejaPrepare)\n" \
7252  " return (iCodRet);\n" \
7253  "\n" \
7254  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
7255  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureRegion\\n\"));\n" \
7256  " /* Controle de la longueur du texte de la requete */\n" \
7257  " iLgRequete = strlen(GIV_RQ_SELECT_NEW_REGION);\n" \
7258  " iLgBuffer = sizeof(cRequete);\n" \
7259  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
7260  "\n" \
7261  " if (iLgBuffer <= iLgRequete)\n" \
7262  " {\n" \
7263  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
7264  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7265  " }\n" \
7266  "\n" \
7267  " /* Construction du texte de la requete */\n" \
7268  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
7269  " {\n" \
7270  " if (0 == strcmp(givtcRegCECI, \"NON\"))\n" \
7271  " {\n" \
7272  " (void)sprintf(cRequete,\n" \
7273  " GIV_RQ_SELECT_REGION);\n" \
7274  " }\n" \
7275  " else\n" \
7276  " {\n" \
7277  " (void)sprintf(cRequete,\n" \
7278  " GIV_RQ_SELECT_NEW_REGION);\n" \
7279  " }\n" \
7280  "\n" \
7281  " GWTTrace(GWT_NIV_FONCT, (\"Requete SQL CECI : %s\\n\", cRequete));\n" \
7282  " /* Controle et parsing de la requete SQL */\n" \
7283  " EXEC SQL\n" \
7284  " prepare rqtLectureRegion\n" \
7285  " from: cRequete;\n" \
7286  " /* Traitement des erreurs SQL */\n" \
7287  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureRegion\");\n" \
7288  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7289  "\n" \
7290  " if ((int4)GIV::GYBok != iIntRet)\n" \
7291  " {\n" \
7292  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureRegion : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7293  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7294  " }\n" \
7295  " else\n" \
7296  " {\n" \
7297  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
7298  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureRegion\");\n" \
7299  " EXEC SQL\n" \
7300  " declare crsLectureRegion\n" \
7301  " cursor\n" \
7302  " for rqtLectureRegion;\n" \
7303  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7304  "\n" \
7305  " if ((int4)GIV::GYBok != iIntRet)\n" \
7306  " {\n" \
7307  " /* Erreur sur declaration curseur SQL */\n" \
7308  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureRegion ...\\n\"));\n" \
7309  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7310  " }\n" \
7311  " }\n" \
7312  " }\n" \
7313  "\n" \
7314  " /* Sortie de la fonction */\n" \
7315  " GWTTrace(GWT_NIV_FONCT, (\"givPreparerLectureRegion\\n\"));\n" \
7316  " return (iCodRet);\n" \
7317  "}\n" \
7318  "\n" \
7319  "/*----Fonction----------------------------------------------------------------*/\n" \
7320  "/* */\n" \
7321  "/* Fonction : givLecAncBloc */\n" \
7322  "/* */\n" \
7323  "/* But : Récupération du blocid antérieur */\n" \
7324  "/* */\n" \
7325  "/* */\n" \
7326  "/* Entree(s) : */\n" \
7327  "/* */\n" \
7328  "/* Sortie(s) : */\n" \
7329  "/* */\n" \
7330  "/* Portable : Surement portable */\n" \
7331  "/* */\n" \
7332  "/*----------------------------------------------------------------------------*/\n" \
7333  "int4 givLecAncBloc(char* apcNumnat, char* apcNumlo, char* apcNumls, char* apcBlocid)\n" \
7334  "{\n" \
7335  " int4 iCodRet = (int4)GIV::GWZOk;\n" \
7336  " int4 iIntRet = (int4)GIV::GYBok;\n" \
7337  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
7338  " GYBrParam_erreurT rErreurSQL;\n" \
7339  " EXEC SQL\n" \
7340  " begin declare\n" \
7341  " section;\n" \
7342  " char tcRequete[800];\n" \
7343  " char* pcNumnat;\n" \
7344  " char* pcNumlo;\n" \
7345  " char* pcNumls;\n" \
7346  " char cBlocid[27 + 1];\n" \
7347  " int2 indicatrice_Blocid;\n" \
7348  " int4 iNbIns;\n" \
7349  " EXEC SQL\n" \
7350  " VAR cBlocid\n" \
7351  " IS STRING;\n" \
7352  " EXEC SQL\n" \
7353  " end declare\n" \
7354  " section;\n" \
7355  "\n" \
7356  " /* Préparer la requête */\n" \
7357  " if ((int4)GIV::GWCCodeOK != iDejaPrepare)\n" \
7358  " {\n" \
7359  " (void)sprintf(tcRequete, GIV_RQ_SELECT_ANC_BLOC, GIXcNomFour, GIXcNomDest, GIXcDepartement, GIXcDepartement);\n" \
7360  " EXEC SQL\n" \
7361  " prepare rqtLectAncBloc\n" \
7362  " from: tcRequete;\n" \
7363  " iIntRet = GIVBlocErreur(&rErreurSQL);\n" \
7364  "\n" \
7365  " if ((int4)GIV::GYBok != iIntRet)\n" \
7366  " {\n" \
7367  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur prepare rqtLectAncBloc: [COD=%d TXT=%s]\\n\", iIntRet, rErreurSQL.acDonnees_retour));\n" \
7368  " iCodRet = (int4)GIV::GWZKo;\n" \
7369  " }\n" \
7370  "\n" \
7371  " EXEC SQL\n" \
7372  " declare crsLectAncBloc\n" \
7373  " cursor\n" \
7374  " for rqtLectAncBloc;\n" \
7375  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
7376  " }\n" \
7377  "\n" \
7378  " /* initialisation des variables */\n" \
7379  " if ((int4)GIV::GWZOk == iCodRet)\n" \
7380  " {\n" \
7381  " pcNumnat = apcNumnat;\n" \
7382  " pcNumlo = apcNumlo;\n" \
7383  " pcNumls = apcNumls;\n" \
7384  " }\n" \
7385  "\n" \
7386  " cBlocid[0] = '\\0';\n" \
7387  " GWTTrace(GWT_NIV_FONCT, (\"LecAncBloc: <%s>,<%s>,<%s>\\n\", apcNumnat, apcNumlo, apcNumls));\n" \
7388  "\n" \
7389  " /* Ouvrir le curseur */\n" \
7390  " if (GIV::GWZOk == iCodRet)\n" \
7391  " {\n" \
7392  " EXEC SQL\n" \
7393  " OPEN crsLectAncBloc\n" \
7394  " USING :pcNumnat,:pcNumlo,:pcNumls;\n" \
7395  " iIntRet = GIVBlocErreur(&rErreurSQL);\n" \
7396  "\n" \
7397  " if ((int4)GIV::GYBok != iIntRet)\n" \
7398  " {\n" \
7399  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur open crsLectAncBloc: [COD=%d TXT=%s]\\n\", iIntRet, rErreurSQL.acDonnees_retour));\n" \
7400  " iCodRet = (int4)GIV::GWZKo;\n" \
7401  " }\n" \
7402  " }\n" \
7403  "\n" \
7404  " /* Récupération des indicateurs */\n" \
7405  " if (GIV::GWZOk == iCodRet)\n" \
7406  " {\n" \
7407  " EXEC SQL\n" \
7408  " FETCH crsLectAncBloc\n" \
7409  " INTO: cBlocid: indicatrice_Blocid;\n" \
7410  " iIntRet = GIVBlocErreur(&rErreurSQL);\n" \
7411  "\n" \
7412  " if ((int4)GIV::GYBok != iIntRet)\n" \
7413  " {\n" \
7414  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur fetch crsLectAncBloc: [COD=%d TXT=%s]\\n\", iIntRet, rErreurSQL.acDonnees_retour));\n" \
7415  " iCodRet = (int4)GIV::GWZKo;\n" \
7416  " }\n" \
7417  " }\n" \
7418  "\n" \
7419  " /* fermer le curseur */\n" \
7420  " EXEC SQL\n" \
7421  " close crsLectAncBloc;\n" \
7422  " iIntRet = GIVBlocErreur(&rErreurSQL);\n" \
7423  "\n" \
7424  " if ((int4)GIV::GYBok != iIntRet)\n" \
7425  " {\n" \
7426  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur fermeture crsLectAncBloc: [COD=%d TXT=%s]\\n\", iIntRet, rErreurSQL.acDonnees_retour));\n" \
7427  " iCodRet = (int4)GIV::GWZKo;\n" \
7428  " }\n" \
7429  "\n" \
7430  " if (((int2)GIV::GYBok != indicatrice_Blocid) || (GIV::GWZOk != iCodRet))\n" \
7431  " apcBlocid[0] = '\\0';\n" \
7432  " else\n" \
7433  " strcpy(apcBlocid, cBlocid);\n" \
7434  "\n" \
7435  " return (iCodRet);\n" \
7436  "}\n" \
7437  "\n" \
7438  "/*----------------------------------Fonction----------------------------------*\n" \
7439  " * Fonction : givLectureLibRub\n" \
7440  " *\n" \
7441  " * But : Conversion du type de voie en libélé de type de voie.\n" \
7442  " *\n" \
7443  " * Description : Lecture du libélé de type de voie correspondant au type de voie\n" \
7444  " * dans la table GYTtabPetvoi.\n" \
7445  " * En cas d'absence ddu type de voie dans la table GYTtabPetvoi\n" \
7446  " * on prend le type de voie tel quel.\n" \
7447  " *\n" \
7448  " *\n" \
7449  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
7450  "\n" \
7451  "int4 givLectureLibRub(char* val_codan9)\n" \
7452  "{\n" \
7453  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
7454  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
7455  " int1 indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
7456  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
7457  " int4 iIdx, iLg;\n" \
7458  " EXEC SQL\n" \
7459  " begin declare\n" \
7460  " section;\n" \
7461  " VARCHAR libelle_rub[300 + 1];\n" \
7462  " VARCHAR codeAn9[8 + 1];\n" \
7463  " int2 sLibCod_i = -1;\n" \
7464  " EXEC SQL\n" \
7465  " end declare\n" \
7466  " section;\n" \
7467  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
7468  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
7469  " iIntRet = givPreparerLectureRJRUPR();\n" \
7470  " GIVBuffInter[0] = '\\0';\n" \
7471  "\n" \
7472  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
7473  " {\n" \
7474  " memset((char*)codeAn9.arr, ' ', sizeof(codeAn9.arr));\n" \
7475  " memcpy((char*)codeAn9.arr, val_codan9, strlen(val_codan9));\n" \
7476  " codeAn9.len = strlen(val_codan9);\n" \
7477  " }\n" \
7478  " else\n" \
7479  " GWTTrace(GWT_NIV_FONCT, (\"code an9: <%s>,%d\\n\", val_codan9, strlen(val_codan9)));\n" \
7480  "\n" \
7481  " if (GIV::GIXCodeOK == iIntRet)\n" \
7482  " {\n" \
7483  " EXEC SQL\n" \
7484  " OPEN crsLectureRJRUPR\n" \
7485  " USING: codeAn9;\n" \
7486  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7487  "\n" \
7488  " if ((int4)GIV::GYBok != iIntRet)\n" \
7489  " {\n" \
7490  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureRJRUPR: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7491  " iIntRet = (int4)GIV::GWZKo;\n" \
7492  " }\n" \
7493  " }\n" \
7494  "\n" \
7495  " if (GIV::GIXCodeOK == iIntRet)\n" \
7496  " {\n" \
7497  " EXEC SQL\n" \
7498  " FETCH crsLectureRJRUPR\n" \
7499  " INTO: libelle_rub: sLibCod_i;\n" \
7500  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7501  "\n" \
7502  " if ((int4)GIV::GYBok != iIntRet)\n" \
7503  " {\n" \
7504  " if (GIV::GYBnodata == iIntRet)\n" \
7505  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
7506  " else\n" \
7507  " {\n" \
7508  " GWTTrace(GWT_NIV_FONCT, (\"Erreur fetch crsLectureRJRUPR: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7509  " iIntRet = (int4)GIV::GIXCodeKO;\n" \
7510  " }\n" \
7511  " }\n" \
7512  " else\n" \
7513  " {\n" \
7514  " memcpy(GIVBuffInter, (char*)libelle_rub.arr, libelle_rub.len);\n" \
7515  " GIVBuffInter[libelle_rub.len] = '\\0';\n" \
7516  "\n" \
7517  " if ((int4)GIV::GWCCodeOK == giviPart)\n" \
7518  " {\n" \
7519  " iLg = libelle_rub.len;\n" \
7520  " GIVBuffInter[iLg] = '\\0';\n" \
7521  " }\n" \
7522  "\n" \
7523  " GWTTrace(GWT_NIV_FONCT, (\"libellé de rub: <%s>,%d\\n\", GIVBuffInter, libelle_rub.len));\n" \
7524  " }\n" \
7525  " }\n" \
7526  "\n" \
7527  " EXEC SQL\n" \
7528  " close crsLectureRJRUPR;\n" \
7529  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7530  "\n" \
7531  " if ((int4)GIV::GYBok != iIntRet)\n" \
7532  " {\n" \
7533  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureRJRUPR: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7534  " iIntRet = (int4)GIV::GIXCodeKO;\n" \
7535  " }\n" \
7536  "\n" \
7537  " return (iCodRet);\n" \
7538  "}\n" \
7539  "\n" \
7540  "/*----------------------------------Fonction----------------------------------*\n" \
7541  " * Fonction : givLectureLibLocAtt\n" \
7542  " *\n" \
7543  " * But : localite de rattachement.\n" \
7544  " *\n" \
7545  " * Description : Lecture du libéllé de localité de rattachement\n" \
7546  " *\n" \
7547  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
7548  "\n" \
7549  "int4 givLectureLibLocAtt(char** buf_pos_in, char* apcDepLocInst, char* apcEtab)\n" \
7550  "{\n" \
7551  " int4 iCodRet; /* Code retour de la fonction */\n" \
7552  " int4 iIntRet; /* Code retour des appels internes */\n" \
7553  " int1 indFinFetch; /* Indicateur de fin de balayage du curseur */\n" \
7554  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
7555  " EXEC SQL\n" \
7556  " begin declare\n" \
7557  " section;\n" \
7558  " GYBrPelrepT* pvCodloc;\n" \
7559  " GYBrIndPelrepT* pvIndCodloc;\n" \
7560  " EXEC SQL\n" \
7561  " end declare\n" \
7562  " section;\n" \
7563  " int4 pipe; /* Flag pour ajout pipe */\n" \
7564  " char* buf_pos;\n" \
7565  " int4 lg_write;\n" \
7566  " GWTTrace(GWT_NIV_FONCT, (\"givLectureLibLocAtt\\n\"));\n" \
7567  " /* Initialisation des variables locales */\n" \
7568  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
7569  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
7570  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
7571  " /* Initialisation pointeur */\n" \
7572  " buf_pos = *buf_pos_in;\n" \
7573  " /* Valorisation du pointeur vers la structure de description de la table PAYS */\n" \
7574  " pvCodloc = &GIVvLocrep;\n" \
7575  " pvIndCodloc = &GIVvIndLocrep;\n" \
7576  " /* Valorisation du pointeur vers la structure de description */\n" \
7577  " /* du tableau de recuperation des correspondances AN8/AN9 */\n" \
7578  " (void)memcpy(pvCodloc->acDepart, &apcDepLocInst[0], GYBIeinscLgDeppar);\n" \
7579  " pvCodloc->acDepart[GYBIeinscLgDeppar] = '\\0';\n" \
7580  " (void)strcpy(pvCodloc->acNumloc, &apcDepLocInst[GYBIeinscLgDeppar]);\n" \
7581  " /* Ouverture curseur SQL (car requete type SELECT) */\n" \
7582  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureLocAtt\");\n" \
7583  " EXEC SQL\n" \
7584  " open crsLectureLocAtt\n" \
7585  " using :pvCodloc->acDepart,\n" \
7586  " :pvCodloc->acNumloc;\n" \
7587  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7588  "\n" \
7589  " if ((int4)GIV::GYBok != iIntRet)\n" \
7590  " {\n" \
7591  " /* Erreur sur declaration curseur SQL */\n" \
7592  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open rqtLectureLocAtt : [COD=%d TXT=%s EPJ=%s LOC=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab, apcDepLocInst));\n" \
7593  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7594  " }\n" \
7595  " else\n" \
7596  " {\n" \
7597  " /* Execution requete de denombrement (FETCH du curseur) */\n" \
7598  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
7599  " pipe = 0;\n" \
7600  "\n" \
7601  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
7602  " {\n" \
7603  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureLocAtt\");\n" \
7604  " EXEC SQL\n" \
7605  " fetch crsLectureLocAtt\n" \
7606  " into\n" \
7607  " :pvCodloc->acLibloc\n" \
7608  " :pvIndCodloc->sLiblocI;\n" \
7609  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7610  "\n" \
7611  " /* Analyse du code retour SQL */\n" \
7612  " switch (iIntRet)\n" \
7613  " {\n" \
7614  " case (int4)GIV::GYBok:\n" \
7615  " {\n" \
7616  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
7617  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
7618  "\n" \
7619  " if (pipe == 0)\n" \
7620  " pipe = 1;\n" \
7621  "\n" \
7622  " lg_write = giv_ecrit_balise(buf_pos, GIVvLocrep.acLibloc, \"liblocatt\");\n" \
7623  " buf_pos = buf_pos + lg_write;\n" \
7624  " break;\n" \
7625  " }\n" \
7626  "\n" \
7627  " case (int4)GIV::GYBnodata:\n" \
7628  " {\n" \
7629  " /* la localite n'existe pas */\n" \
7630  " /* generer une signalisation */\n" \
7631  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
7632  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7633  " break;\n" \
7634  " }\n" \
7635  "\n" \
7636  " default:\n" \
7637  " {\n" \
7638  " /* la consultation de la base s'est mal passee */\n" \
7639  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur execute rqtLectureLocAtt : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7640  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
7641  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7642  " break;\n" \
7643  " }\n" \
7644  " }\n" \
7645  " }\n" \
7646  "\n" \
7647  " *buf_pos_in = buf_pos;\n" \
7648  " /* Fermeture du curseur */\n" \
7649  " (void)strcpy(vErreurSQL.acOrdre_sql, \"close crsLectureLocAtt\");\n" \
7650  " EXEC SQL\n" \
7651  " close crsLectureLocAtt;\n" \
7652  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7653  "\n" \
7654  " if ((int4)GIV::GYBok != iIntRet)\n" \
7655  " {\n" \
7656  " /* Erreur sur fermeture curseur SQL */\n" \
7657  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur CLOSE crsLectureLocAtt ...\\n\"));\n" \
7658  " }\n" \
7659  " }\n" \
7660  "\n" \
7661  " /* Sortie de la fonction */\n" \
7662  " GWTTrace(GWT_NIV_FONCT, (\"GIVLectureLibLocAtt\\n\"));\n" \
7663  " return (iCodRet);\n" \
7664  "}\n" \
7665  "\n" \
7666  "/*----------------------------------Fonction----------------------------------*\n" \
7667  " * Fonction : givLectureLocDep\n" \
7668  " *\n" \
7669  " * But : localite d'un département.\n" \
7670  " *\n" \
7671  " * Description : Lecture du libéllé de localité de rattachement\n" \
7672  " *\n" \
7673  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
7674  "\n" \
7675  "int4 givLectureLocDep(char* apcDep, int4* apiAjout)\n" \
7676  "{\n" \
7677  " int4 iCodRet; /* Code retour de la fonction */\n" \
7678  " int4 iIntRet; /* Code retour des appels internes */\n" \
7679  " int1 indFinFetch; /* Indicateur de fin de balayage du curseur */\n" \
7680  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
7681  " EXEC SQL\n" \
7682  " begin declare\n" \
7683  " section;\n" \
7684  " GYBrPelrepT* pvCodloc;\n" \
7685  " GYBrIndPelrepT* pvIndCodloc;\n" \
7686  " EXEC SQL\n" \
7687  " end declare\n" \
7688  " section;\n" \
7689  " GWTTrace(GWT_NIV_FONCT, (\"givLectureLocDep\\n\"));\n" \
7690  " /* Initialisation des variables locales */\n" \
7691  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
7692  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
7693  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
7694  " /* Valorisation du pointeur vers la structure de description de la table PAYS */\n" \
7695  " pvCodloc = &GIVvLocrep;\n" \
7696  " pvIndCodloc = &GIVvIndLocrep;\n" \
7697  " /* Valorisation du pointeur vers la structure de description */\n" \
7698  " /* du tableau de recuperation des correspondances AN8/AN9 */\n" \
7699  " (void)strcpy(pvCodloc->acDepart, apcDep);\n" \
7700  " /* Ouverture curseur SQL (car requete type SELECT) */\n" \
7701  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureLocDep\");\n" \
7702  " EXEC SQL\n" \
7703  " open crsLectureLocDep\n" \
7704  " using :pvCodloc->acDepart;\n" \
7705  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7706  "\n" \
7707  " if ((int4)GIV::GYBok != iIntRet)\n" \
7708  " {\n" \
7709  " /* Erreur sur declaration curseur SQL */\n" \
7710  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur OPEN crsLectureLocDep ...\\n\"));\n" \
7711  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7712  " }\n" \
7713  " else\n" \
7714  " {\n" \
7715  " /* Execution requete de denombrement (FETCH du curseur) */\n" \
7716  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
7717  "\n" \
7718  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
7719  " {\n" \
7720  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureLocDep\");\n" \
7721  " EXEC SQL\n" \
7722  " fetch crsLectureLocDep\n" \
7723  " into\n" \
7724  " :pvCodloc->acNumloc\n" \
7725  " :pvIndCodloc->sNumlocI;\n" \
7726  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7727  "\n" \
7728  " /* Analyse du code retour SQL */\n" \
7729  " switch (iIntRet)\n" \
7730  " {\n" \
7731  " case (int4)GIV::GYBok:\n" \
7732  " {\n" \
7733  " if (0 == *apiAjout)\n" \
7734  " {\n" \
7735  " strcpy(buf_concat, apcDep);\n" \
7736  " *apiAjout = 1;\n" \
7737  " }\n" \
7738  " else\n" \
7739  " {\n" \
7740  " strcat(buf_concat, \"|\");\n" \
7741  " strcat(buf_concat, apcDep);\n" \
7742  " }\n" \
7743  "\n" \
7744  " strcat(buf_concat, GIVvLocrep.acNumloc);\n" \
7745  " break;\n" \
7746  " }\n" \
7747  "\n" \
7748  " case (int4)GIV::GYBnodata:\n" \
7749  " {\n" \
7750  " /* fin */\n" \
7751  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
7752  " break;\n" \
7753  " }\n" \
7754  "\n" \
7755  " default:\n" \
7756  " {\n" \
7757  " /* la consultation de la base s'est mal passee */\n" \
7758  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur execute rqtLectureLocDep : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7759  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
7760  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7761  " break;\n" \
7762  " }\n" \
7763  " }\n" \
7764  " }\n" \
7765  "\n" \
7766  " /* Fermeture du curseur */\n" \
7767  " (void)strcpy(vErreurSQL.acOrdre_sql, \"close crsLectureLocDep\");\n" \
7768  " EXEC SQL\n" \
7769  " close crsLectureLocDep;\n" \
7770  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7771  "\n" \
7772  " if ((int4)GIV::GYBok != iIntRet)\n" \
7773  " {\n" \
7774  " /* Erreur sur fermeture curseur SQL */\n" \
7775  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur CLOSE crsLectureLocDep ...\\n\"));\n" \
7776  " }\n" \
7777  " }\n" \
7778  "\n" \
7779  " /* Sortie de la fonction */\n" \
7780  " GWTTrace(GWT_NIV_FONCT, (\"givLectureLocDep %s\\n\", buf_concat));\n" \
7781  " return (iCodRet);\n" \
7782  "}\n" \
7783  "\n" \
7784  "/*----------------------------------Fonction----------------------------------*\n" \
7785  " * Fonction : givLectureThemeRub\n" \
7786  " *\n" \
7787  " * But : theme de rubrique.\n" \
7788  " *\n" \
7789  " * Description : Lecture du theme d'une rubrique\n" \
7790  " * dans la table GYTtabThemeED.\n" \
7791  " *\n" \
7792  " *\n" \
7793  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
7794  "\n" \
7795  "int4 givLectureThemeED(char* val_codan9)\n" \
7796  "{\n" \
7797  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
7798  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
7799  " int1 indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
7800  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
7801  " int4 iIdx;\n" \
7802  " int4 j;\n" \
7803  " EXEC SQL\n" \
7804  " begin declare\n" \
7805  " section;\n" \
7806  " char theme_rub;\n" \
7807  " char codeAn9[8 + 1];\n" \
7808  " EXEC SQL\n" \
7809  " end declare\n" \
7810  " section;\n" \
7811  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
7812  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
7813  " buf_concat[0] = '\\0';\n" \
7814  " iIntRet = givPreparerLectureThemeED();\n" \
7815  "\n" \
7816  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
7817  " strcpy(&codeAn9[0], val_codan9);\n" \
7818  "\n" \
7819  " GWTTrace(GWT_NIV_FONCT, (\"code an9: <%s>,%d\\n\", val_codan9, strlen(val_codan9)));\n" \
7820  "\n" \
7821  " if (GIV::GIXCodeOK == iIntRet)\n" \
7822  " {\n" \
7823  " /* Traitement des erreurs SQL */\n" \
7824  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureThemeED\");\n" \
7825  " EXEC SQL\n" \
7826  " OPEN crsLectureThemeED\n" \
7827  " USING: codeAn9;\n" \
7828  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7829  "\n" \
7830  " if ((int4)GIV::GYBok != iIntRet)\n" \
7831  " {\n" \
7832  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureThemeED: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7833  " iIntRet = (int4)GIV::GWZKo;\n" \
7834  " }\n" \
7835  " }\n" \
7836  "\n" \
7837  " if (GIV::GIXCodeOK == iIntRet)\n" \
7838  " {\n" \
7839  " EXEC SQL\n" \
7840  " FETCH crsLectureThemeED\n" \
7841  " INTO: theme_rub;\n" \
7842  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7843  "\n" \
7844  " if ((int4)GIV::GYBok != iIntRet)\n" \
7845  " {\n" \
7846  " if (GIV::GYBnodata == iIntRet)\n" \
7847  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
7848  " else\n" \
7849  " {\n" \
7850  " GWTTrace(GWT_NIV_FONCT, (\"Erreur fetch crsLectureThemeED: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7851  " iIntRet = (int4)GIV::GIXCodeKO;\n" \
7852  " }\n" \
7853  " }\n" \
7854  " else\n" \
7855  " {\n" \
7856  " buf_concat[0] = theme_rub;\n" \
7857  " buf_concat[1] = '\\0';\n" \
7858  " GWTTrace(GWT_NIV_FONCT, (\"theme de rub: <%s>\\n\", buf_concat));\n" \
7859  " }\n" \
7860  " }\n" \
7861  "\n" \
7862  " EXEC SQL\n" \
7863  " close crsLectureThemeED;\n" \
7864  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7865  "\n" \
7866  " if ((int4)GIV::GYBok != iIntRet)\n" \
7867  " {\n" \
7868  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureThemeED: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7869  " iIntRet = (int4)GIV::GIXCodeKO;\n" \
7870  " }\n" \
7871  "\n" \
7872  " return (iCodRet);\n" \
7873  "}\n" \
7874  "\n" \
7875  "/*----------------------------------Fonction----------------------------------*\n" \
7876  " * Fonction : givLectureTypeURL\n" \
7877  " *\n" \
7878  " * But : type de l'URL.\n" \
7879  " *\n" \
7880  " * Description : Lecture du type d'URL\n" \
7881  " * dans la table GYTtabPemicURL.\n" \
7882  " *\n" \
7883  " *\n" \
7884  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
7885  "\n" \
7886  "int4 givLectureTypeURL(GYBrIamicT* aprIamic, GYBrIndIamicT* aprIndIamic)\n" \
7887  "{\n" \
7888  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
7889  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
7890  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
7891  " int4 i, j;\n" \
7892  " size_t lgInter, lg_in;\n" \
7893  " iconv_t iConv;\n" \
7894  " char* buf_in;\n" \
7895  " char* buf_out;\n" \
7896  " EXEC SQL\n" \
7897  " begin declare\n" \
7898  " section;\n" \
7899  " GYBrIamicT* prOraIamic;\n" \
7900  " GYBrIndIamicT* prOraIndIamic;\n" \
7901  " EXEC SQL\n" \
7902  " end declare\n" \
7903  " section;\n" \
7904  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
7905  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
7906  " prOraIamic = aprIamic;\n" \
7907  " prOraIndIamic = aprIndIamic;\n" \
7908  " buf_concat[0] = '\\0';\n" \
7909  " /* Traitement des erreurs SQL */\n" \
7910  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureTypeURL\");\n" \
7911  " EXEC SQL\n" \
7912  " OPEN crsLectureTypeURL\n" \
7913  " USING :prOraIamic->acNumobj,\n" \
7914  " :prOraIamic->acTypobj,\n" \
7915  " :prOraIamic->acTpdsob;\n" \
7916  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7917  "\n" \
7918  " if ((int4)GIV::GYBok != iIntRet)\n" \
7919  " {\n" \
7920  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureTypeURL: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7921  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7922  " }\n" \
7923  "\n" \
7924  " if ((int4)GIV::GYBok == iIntRet)\n" \
7925  " {\n" \
7926  " EXEC SQL\n" \
7927  " FETCH crsLectureTypeURL\n" \
7928  " INTO\n" \
7929  " :prOraIamic->acTpdUrl\n" \
7930  " :prOraIndIamic->sTpdUrlI,\n" \
7931  " :prOraIamic->acLibUrl:prOraIndIamic->sLibUrlI;\n" \
7932  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7933  "\n" \
7934  " if ((int4)GIV::GYBok != iIntRet)\n" \
7935  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7936  " }\n" \
7937  "\n" \
7938  " EXEC SQL\n" \
7939  " close crsLectureTypeURL;\n" \
7940  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
7941  "\n" \
7942  " if (((int4)GIV::GYBok != iIntRet) || ((int4)GIV::GYBok != prOraIndIamic->sLibUrlI))\n" \
7943  " {\n" \
7944  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureTypeURL: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
7945  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
7946  " }\n" \
7947  " else\n" \
7948  " givConvURL(aprIamic->acLibUrl);\n" \
7949  "\n" \
7950  " return (iCodRet);\n" \
7951  "}\n" \
7952  "\n" \
7953  "/*----------------------------------Fonction----------------------------------*\n" \
7954  " * Fonction : givLectureImag\n" \
7955  " *\n" \
7956  " * But : nombre d'images d'un produit PVI.\n" \
7957  " *\n" \
7958  " * Description : Lecture du nombre\n" \
7959  " * dans la table GYTtabPVIMAG.\n" \
7960  " *\n" \
7961  " *\n" \
7962  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
7963  "\n" \
7964  "int4 givLectureImag(GYBrIamicT* aprIamic, char* prNbimag, char* prImagCat, char* pcMenu)\n" \
7965  "{\n" \
7966  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
7967  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
7968  " int1 indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
7969  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
7970  " int4 iIdx;\n" \
7971  " int4 j;\n" \
7972  " EXEC SQL\n" \
7973  " begin declare\n" \
7974  " section;\n" \
7975  " GYBrIamicT* prOraIamic;\n" \
7976  " char prOraRef[20];\n" \
7977  " int2 sIndic;\n" \
7978  " char tcOraRef[2];\n" \
7979  " char cOraMenu;\n" \
7980  " EXEC SQL\n" \
7981  " VAR prOraRef\n" \
7982  " IS STRING;\n" \
7983  " EXEC SQL\n" \
7984  " end declare\n" \
7985  " section;\n" \
7986  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
7987  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
7988  " prOraIamic = aprIamic;\n" \
7989  " prNbimag[0] = '\\0';\n" \
7990  " prImagCat[0] = '\\0';\n" \
7991  " tcOraRef[0] = '\\0';\n" \
7992  " prOraRef[0] = '\\0';\n" \
7993  " pcMenu[0] = '\\0';\n" \
7994  " /* Traitement des erreurs SQL */\n" \
7995  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureImag\");\n" \
7996  " EXEC SQL\n" \
7997  " OPEN crsLectureImag\n" \
7998  " USING: prOraIamic->acNumobj;\n" \
7999  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8000  "\n" \
8001  " if ((int4)GIV::GYBok != iIntRet)\n" \
8002  " {\n" \
8003  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureImag: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
8004  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8005  " }\n" \
8006  "\n" \
8007  " if ((int4)GIV::GYBok == iIntRet)\n" \
8008  " {\n" \
8009  " EXEC SQL\n" \
8010  " FETCH crsLectureImag\n" \
8011  " INTO\n" \
8012  " :prOraRef:sIndic, :tcOraRef, :cOraMenu;\n" \
8013  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8014  "\n" \
8015  " if ((int4)GIV::GYBok != iIntRet)\n" \
8016  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8017  " else\n" \
8018  " {\n" \
8019  " strcpy(prNbimag, prOraRef);\n" \
8020  " strcpy(prImagCat, tcOraRef);\n" \
8021  " *pcMenu = cOraMenu;\n" \
8022  " }\n" \
8023  " }\n" \
8024  "\n" \
8025  " EXEC SQL\n" \
8026  " close crsLectureImag;\n" \
8027  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8028  "\n" \
8029  " if ((int4)GIV::GYBok != iIntRet)\n" \
8030  " {\n" \
8031  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureImag: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
8032  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8033  " }\n" \
8034  "\n" \
8035  " GWTTrace(GWT_NIV_FONCT, (\"Imag: %s, %s, %c\\n\", prOraIamic->acNumobj, prNbimag, pcMenu));\n" \
8036  " return (iCodRet);\n" \
8037  "}\n" \
8038  "\n" \
8039  "/*----------------------------------Fonction----------------------------------*\n" \
8040  " * Fonction : givLectureMotsCles\n" \
8041  " *\n" \
8042  " * But : crc mots cles\n" \
8043  " *\n" \
8044  " * Description : lecture terme de cri\n" \
8045  " * dans la table GYTtabMotsClesCri.\n" \
8046  " *\n" \
8047  " *\n" \
8048  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
8049  "\n" \
8050  "int4 givLectureMotsCles(GYBrIamicT* aprIamic)\n" \
8051  "{\n" \
8052  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
8053  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
8054  " int1 indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
8055  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
8056  " int4 i, j;\n" \
8057  " char tcAn9Courant[GYBPaprofLgCodan9 + 1];\n" \
8058  " EXEC SQL\n" \
8059  " begin declare\n" \
8060  " section;\n" \
8061  " GYBrIamicT* prOraIamic;\n" \
8062  " GYBrIaprofT prOraIaprof;\n" \
8063  " GYBstrMClesCriAnnotT tcAnnotMCle; /* annotation mots clés */\n" \
8064  " GYBstrMClesCriIdT tcIdMCle;\n" \
8065  " EXEC SQL\n" \
8066  " end declare\n" \
8067  " section;\n" \
8068  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
8069  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
8070  " prOraIamic = aprIamic;\n" \
8071  " /* Traitement des erreurs SQL */\n" \
8072  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureMCles\");\n" \
8073  " EXEC SQL\n" \
8074  " OPEN crsLectureMCles\n" \
8075  " USING: prOraIamic->acNumobj;\n" \
8076  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8077  "\n" \
8078  " if ((int4)GIV::GYBok != iIntRet)\n" \
8079  " {\n" \
8080  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureMCles: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
8081  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8082  " }\n" \
8083  "\n" \
8084  " GWTTrace(GWT_NIV_FONCT, (\"Objet Mot Clé cherché : '%s'\\n\", prOraIamic->acNumobj));\n" \
8085  "\n" \
8086  " if ((int4)GIV::GYBok == iIntRet)\n" \
8087  " {\n" \
8088  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8089  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
8090  "\n" \
8091  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
8092  " {\n" \
8093  " EXEC SQL\n" \
8094  " FETCH crsLectureMCles\n" \
8095  " INTO\n" \
8096  " :tcIdMCle,\n" \
8097  " :prOraIaprof.acCodan8,\n" \
8098  " :tcAnnotMCle;\n" \
8099  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8100  "\n" \
8101  " switch (iIntRet)\n" \
8102  " {\n" \
8103  " case (int4)GIV::GYBok:\n" \
8104  " {\n" \
8105  " if (NULL != strstr(GIVBuffClob, tcIdMCle))\n" \
8106  " break;\n" \
8107  "\n" \
8108  " /* recherche de la rubrique de CRI parmi les rubriques du bloc */\n" \
8109  " i = 0;\n" \
8110  " GWTTrace(GWT_NIV_FONCT, (\"Critère Mot Clé trouvé : '%s', '%s'\\n\", tcIdMCle, prOraIaprof.acCodan8));\n" \
8111  " strcpy(tcAn9Courant, givcR00000000);\n" \
8112  "\n" \
8113  " for (i = 0; i < (givrListParu.iNbr); i++)\n" \
8114  " {\n" \
8115  " j = givrListParu.trEltRangList[i];\n" \
8116  "\n" \
8117  " if (0 != strcmp(tcAn9Courant, givrListParu.trEltList[j].rub))\n" \
8118  " {\n" \
8119  " strcpy(tcAn9Courant, givrListParu.trEltList[j].rub);\n" \
8120  "\n" \
8121  " if (0 == strcmp(prOraIaprof.acCodan8, givrListParu.trEltList[j].rubinit))\n" \
8122  " break;\n" \
8123  " }\n" \
8124  " }\n" \
8125  "\n" \
8126  " if ((givrListParu.iNbr != i) && (0 != strcmp(givcR000000, prOraIaprof.acCodan8)))\n" \
8127  " {\n" \
8128  " GWTTrace(GWT_NIV_FONCT, (\"Critère Mot Clé validé : '%s', '%s'\\n\", tcIdMCle, prOraIaprof.acCodan8));\n" \
8129  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
8130  "\n" \
8131  " if ((int4)sizeof(GIVBuffInter) <= ((int4)strlen(GIVBuffInter) + (int4)strlen(tcAnnotMCle)))\n" \
8132  " {\n" \
8133  " /* fin car buffer insuffisant */\n" \
8134  " GWTTrace(GWT_NIV_GRAVE, (\"Buffer lecture CRI Mots Clés insuffisant : %d, %s\\n\", (int4)strlen(GIVBuffInter), prOraIamic->acNumobj));\n" \
8135  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8136  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
8137  " break;\n" \
8138  " }\n" \
8139  "\n" \
8140  " (void)strcat(GIVBuffInter, tcAnnotMCle);\n" \
8141  "\n" \
8142  " if ((int4)sizeof(GIVBuffClob) <= ((int4)strlen(GIVBuffClob) + (int4)strlen(tcIdMCle)))\n" \
8143  " {\n" \
8144  " /* fin car buffer insuffisant */\n" \
8145  " GWTTrace(GWT_NIV_GRAVE, (\"Buffer lecture ID Mots Clés insuffisant : %d, %s\\n\", (int4)strlen(GIVBuffClob), prOraIamic->acNumobj));\n" \
8146  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8147  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
8148  " break;\n" \
8149  " }\n" \
8150  "\n" \
8151  " if (0 == strlen(GIVBuffClob))\n" \
8152  " strcpy(GIVBuffClob, tcIdMCle);\n" \
8153  " else\n" \
8154  " {\n" \
8155  " strcat(GIVBuffClob, \"|\");\n" \
8156  " strcat(GIVBuffClob, tcIdMCle);\n" \
8157  " }\n" \
8158  " }\n" \
8159  "\n" \
8160  " break;\n" \
8161  " }\n" \
8162  "\n" \
8163  " case (int4)GIV::GYBnodata:\n" \
8164  " {\n" \
8165  " /* il n'existe pas ou plus de liens */\n" \
8166  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
8167  " break;\n" \
8168  " }\n" \
8169  "\n" \
8170  " default:\n" \
8171  " {\n" \
8172  " /* la consultation de la base s'est mal passee */\n" \
8173  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur execute rqtLectureMCles : [COD=%d TXT=%s] [numobj=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour, prOraIamic->acNumobj));\n" \
8174  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8175  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
8176  " break;\n" \
8177  " }\n" \
8178  " }\n" \
8179  " }\n" \
8180  " }\n" \
8181  "\n" \
8182  " EXEC SQL\n" \
8183  " close crsLectureMCles;\n" \
8184  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8185  "\n" \
8186  " if ((int4)GIV::GYBok != iIntRet)\n" \
8187  " {\n" \
8188  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureMCles: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
8189  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8190  " }\n" \
8191  "\n" \
8192  " GWTTrace(GWT_NIV_FONCT, (\"MotsCles: %d, %s\\n\", iCodRet, tcAnnotMCle));\n" \
8193  " return (iCodRet);\n" \
8194  "}\n" \
8195  "\n" \
8196  "/*----------------------------------Fonction----------------------------------*\n" \
8197  " * Fonction : givLectureEtabDonSupp\n" \
8198  " *\n" \
8199  " * But : données enrichies, données additionnelles.\n" \
8200  " *\n" \
8201  " * Description : lecture\n" \
8202  " * dans la table GYTtabPeetab ou GYTtabDonAddEtab.\n" \
8203  " *\n" \
8204  " *\n" \
8205  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
8206  "\n" \
8207  "int4 givLectureEtabDonSupp(char* apcEtab, char* apcObj, char* apcTyp, char* apcSource)\n" \
8208  "{\n" \
8209  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
8210  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour des appels internes */\n" \
8211  " EXEC SQL\n" \
8212  " begin declare\n" \
8213  " section;\n" \
8214  " char* pcOraEtab;\n" \
8215  " char* pcOraObj;\n" \
8216  " char* pcOraTyp;\n" \
8217  " char* pcOraSce;\n" \
8218  " OCIClobLocator* pClob;\n" \
8219  " static int4 iLgEcrit = 0;\n" \
8220  " char tcRequete[800];\n" \
8221  " nat8 length;\n" \
8222  " int2 sInd, sIndic;\n" \
8223  " EXEC SQL\n" \
8224  " end declare\n" \
8225  " section;\n" \
8226  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
8227  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
8228  " GIVBuffInter[0] = '\\0';\n" \
8229  " /* init CLOB PeEtab */\n" \
8230  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Allocate de CLOB\");\n" \
8231  " EXEC SQL\n" \
8232  " ALLOCATE: pClob;\n" \
8233  " EXEC SQL\n" \
8234  " LOB CREATE\n" \
8235  " TEMPORARY: pClob;\n" \
8236  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8237  " GWTTrace(GWT_NIV_FONCT, (\"Allocation CLOB pour GYTtabPeEtab\\n\"));\n" \
8238  "\n" \
8239  " /* Analyse du code resultat SQL */\n" \
8240  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
8241  " {\n" \
8242  " iCodRet = iIntRet;\n" \
8243  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : [COD=%d TXT=%s]\\n\", iCodRet, vErreurSQL.acOrdre_sql));\n" \
8244  " return (iCodRet);\n" \
8245  " }\n" \
8246  "\n" \
8247  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Prepare SlcDonSupp\");\n" \
8248  "\n" \
8249  " if ((int4)GIV::GWCCodeOK != iDejaPrepare)\n" \
8250  " {\n" \
8251  " GWTTrace(GWT_NIV_FONCT, (\"Préparation accès clob pour GYTtabPeEtab\\n\"));\n" \
8252  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
8253  " (void)sprintf(tcRequete, GIV_SLC_CLOB_DONENR);\n" \
8254  " EXEC SQL\n" \
8255  " prepare rqtSlcDonEnr\n" \
8256  " from: tcRequete;\n" \
8257  " EXEC SQL\n" \
8258  " DECLARE crsSlcDonEnr\n" \
8259  " CURSOR FOR\n" \
8260  " rqtSlcDonEnr;\n" \
8261  " (void)sprintf(tcRequete, GIV_SLC_CLOB_DONREL);\n" \
8262  " EXEC SQL\n" \
8263  " prepare rqtSlcDonRel\n" \
8264  " from: tcRequete;\n" \
8265  " EXEC SQL\n" \
8266  " DECLARE crsSlcDonRel\n" \
8267  " CURSOR FOR\n" \
8268  " rqtSlcDonRel;\n" \
8269  " (void)sprintf(tcRequete, GIV_SLC_CLOB_DONADD);\n" \
8270  " EXEC SQL\n" \
8271  " prepare rqtSlcDonRes\n" \
8272  " from: tcRequete;\n" \
8273  " EXEC SQL\n" \
8274  " DECLARE crsSlcDonRes\n" \
8275  " CURSOR FOR\n" \
8276  " rqtSlcDonRes;\n" \
8277  " (void)sprintf(tcRequete, GIV_SLC_CLOB_DONADD_GCEN);\n" \
8278  " EXEC SQL\n" \
8279  " prepare rqtSlcDonGC\n" \
8280  " from: tcRequete;\n" \
8281  " EXEC SQL\n" \
8282  " DECLARE crsSlcDonGC\n" \
8283  " CURSOR FOR\n" \
8284  " rqtSlcDonGC;\n" \
8285  " (void)sprintf(tcRequete, GIV_SLC_CLOB_ANNONC);\n" \
8286  " EXEC SQL\n" \
8287  " prepare rqtSlcContAnnc\n" \
8288  " from: tcRequete;\n" \
8289  " EXEC SQL\n" \
8290  " DECLARE crsSlcContAnnc\n" \
8291  " CURSOR FOR\n" \
8292  " rqtSlcContAnnc;\n" \
8293  " (void)sprintf(tcRequete, GIV_SLC_CLOB_ETAB);\n" \
8294  " EXEC SQL\n" \
8295  " prepare rqtSlcContEtab\n" \
8296  " from: tcRequete;\n" \
8297  " EXEC SQL\n" \
8298  " DECLARE crsSlcContEtab\n" \
8299  " CURSOR FOR\n" \
8300  " rqtSlcContEtab;\n" \
8301  " (void)sprintf(tcRequete, GIV_SLC_CLOB_ANNOT);\n" \
8302  " EXEC SQL\n" \
8303  " prepare rqtSlcContAnot\n" \
8304  " from: tcRequete;\n" \
8305  " EXEC SQL\n" \
8306  " DECLARE crsSlcContAnot\n" \
8307  " CURSOR FOR\n" \
8308  " rqtSlcContAnot;\n" \
8309  " (void)sprintf(tcRequete, GIV_SLC_CLOB_DHNA);\n" \
8310  " EXEC SQL\n" \
8311  " prepare rqtSlcDonDHNA\n" \
8312  " from: tcRequete;\n" \
8313  " EXEC SQL\n" \
8314  " DECLARE crsSlcDonDHNA\n" \
8315  " CURSOR FOR\n" \
8316  " rqtSlcDonDHNA;\n" \
8317  " (void)sprintf(tcRequete, GIV_SLC_CLOB_DHNE);\n" \
8318  " EXEC SQL\n" \
8319  " prepare rqtSlcDonDHNE\n" \
8320  " from: tcRequete;\n" \
8321  " EXEC SQL\n" \
8322  " DECLARE crsSlcDonDHNE\n" \
8323  " CURSOR FOR\n" \
8324  " rqtSlcDonDHNE;\n" \
8325  " }\n" \
8326  "\n" \
8327  " (void)strcpy(vErreurSQL.acOrdre_sql, \"SlcDonSupp\");\n" \
8328  " GWTTrace(GWT_NIV_FONCT, (\"Ouverture SlcDonSupp\\n\"));\n" \
8329  "\n" \
8330  " if (0 == strcmp(giv_HPN, apcSource))\n" \
8331  " {\n" \
8332  " pcOraTyp = apcTyp;\n" \
8333  " pcOraObj = apcObj;\n" \
8334  " EXEC SQL\n" \
8335  " open crsSlcDonDHNA\n" \
8336  " using :pcOraTyp,:pcOraObj;\n" \
8337  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8338  "\n" \
8339  " if ((int4)GIV::GYBok != iIntRet)\n" \
8340  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsSlcDonDHNA: [COD=%d TXT=%s] %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcObj));\n" \
8341  "\n" \
8342  " EXEC SQL\n" \
8343  " fetch crsSlcDonDHNA\n" \
8344  " into: pClob: sInd;\n" \
8345  " }\n" \
8346  " else if (0 == strcmp(giv_HGN, apcSource))\n" \
8347  " {\n" \
8348  " pcOraEtab = apcEtab;\n" \
8349  " pcOraTyp = apcTyp;\n" \
8350  " pcOraObj = apcObj;\n" \
8351  "\n" \
8352  " if (0 == strcmp(apcTyp, \"DE\"))\n" \
8353  " {\n" \
8354  " sIndic = (int2) - 1;\n" \
8355  " pcOraObj = NULL;\n" \
8356  " }\n" \
8357  " else\n" \
8358  " sIndic = (int2)0;\n" \
8359  "\n" \
8360  " EXEC SQL\n" \
8361  " open crsSlcDonDHNE\n" \
8362  " using :pcOraEtab,:pcOraTyp,:pcOraObj:sIndic;\n" \
8363  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8364  "\n" \
8365  " if ((int4)GIV::GYBok != iIntRet)\n" \
8366  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsSlcDonDHNE: [COD=%d TXT=%s] %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab));\n" \
8367  "\n" \
8368  " EXEC SQL\n" \
8369  " fetch crsSlcDonDHNE\n" \
8370  " into: pClob: sInd;\n" \
8371  " }\n" \
8372  " else if (0 == strlen(apcEtab))\n" \
8373  " {\n" \
8374  " pcOraObj = apcObj;\n" \
8375  " pcOraTyp = apcTyp;\n" \
8376  " EXEC SQL\n" \
8377  " open crsSlcContAnnc\n" \
8378  " using :pcOraObj, :pcOraTyp;\n" \
8379  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8380  "\n" \
8381  " if ((int4)GIV::GYBok != iIntRet)\n" \
8382  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsSlcContAnnc: [COD=%d TXT=%s] %s, %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcObj, apcTyp));\n" \
8383  "\n" \
8384  " EXEC SQL\n" \
8385  " fetch crsSlcContAnnc\n" \
8386  " into: pClob: sInd;\n" \
8387  " }\n" \
8388  " else if (0 == strcmp(giv_EPJ, apcSource))\n" \
8389  " {\n" \
8390  " pcOraEtab = apcEtab;\n" \
8391  " pcOraObj = apcObj;\n" \
8392  " pcOraTyp = apcTyp;\n" \
8393  " EXEC SQL\n" \
8394  " open crsSlcContEtab\n" \
8395  " using :pcOraEtab, :pcOraTyp, :pcOraObj;\n" \
8396  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8397  "\n" \
8398  " if ((int4)GIV::GYBok != iIntRet)\n" \
8399  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsSlcContEtab: [COD=%d TXT=%s] %s, %s, %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab, apcObj, apcTyp));\n" \
8400  "\n" \
8401  " EXEC SQL\n" \
8402  " fetch crsSlcContEtab\n" \
8403  " into: pClob: sInd;\n" \
8404  " }\n" \
8405  " else if (0 == strcmp(giv_ANO, apcSource))\n" \
8406  " {\n" \
8407  " pcOraEtab = apcEtab;\n" \
8408  " pcOraObj = apcObj;\n" \
8409  " pcOraTyp = apcTyp;\n" \
8410  " EXEC SQL\n" \
8411  " open crsSlcContAnot\n" \
8412  " using :pcOraEtab, :pcOraTyp, :pcOraObj;\n" \
8413  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8414  "\n" \
8415  " if ((int4)GIV::GYBok != iIntRet)\n" \
8416  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsSlcContAnot: [COD=%d TXT=%s] %s, %s, %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab, apcObj, apcTyp));\n" \
8417  "\n" \
8418  " EXEC SQL\n" \
8419  " fetch crsSlcContAnot\n" \
8420  " into: pClob: sInd;\n" \
8421  " }\n" \
8422  " else if (0 == strcmp(giv_ENR, apcSource))\n" \
8423  " {\n" \
8424  " pcOraEtab = apcEtab;\n" \
8425  " EXEC SQL\n" \
8426  " open crsSlcDonEnr\n" \
8427  " using :pcOraEtab;\n" \
8428  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8429  "\n" \
8430  " if ((int4)GIV::GYBok != iIntRet)\n" \
8431  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsSlcDonEnr: [COD=%d TXT=%s] %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab));\n" \
8432  "\n" \
8433  " EXEC SQL\n" \
8434  " fetch crsSlcDonEnr\n" \
8435  " into: pClob: sInd;\n" \
8436  " }\n" \
8437  " else if (0 == strcmp(giv_REL, apcSource))\n" \
8438  " {\n" \
8439  " pcOraEtab = apcEtab;\n" \
8440  " EXEC SQL\n" \
8441  " open crsSlcDonRel\n" \
8442  " using :pcOraEtab;\n" \
8443  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8444  "\n" \
8445  " if ((int4)GIV::GYBok != iIntRet)\n" \
8446  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsSlcDonRel: [COD=%d TXT=%s] %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab));\n" \
8447  "\n" \
8448  " EXEC SQL\n" \
8449  " fetch crsSlcDonRel\n" \
8450  " into: pClob: sInd;\n" \
8451  " }\n" \
8452  " else if (0 == strcmp(giv_ADD, apcSource))\n" \
8453  " {\n" \
8454  " pcOraEtab = apcEtab;\n" \
8455  " pcOraTyp = apcTyp;\n" \
8456  " EXEC SQL\n" \
8457  " open crsSlcDonRes\n" \
8458  " using :pcOraEtab, :pcOraTyp;\n" \
8459  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8460  "\n" \
8461  " if ((int4)GIV::GYBok != iIntRet)\n" \
8462  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsSlcDonRes: [COD=%d TXT=%s] %s, %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab, apcTyp));\n" \
8463  "\n" \
8464  " EXEC SQL\n" \
8465  " fetch crsSlcDonRes\n" \
8466  " into: pClob: sInd;\n" \
8467  " }\n" \
8468  " else if (0 == strcmp(giv_ADG, apcSource))\n" \
8469  " {\n" \
8470  " pcOraEtab = apcEtab;\n" \
8471  " pcOraTyp = apcTyp;\n" \
8472  " EXEC SQL\n" \
8473  " open crsSlcDonGC\n" \
8474  " using :pcOraEtab, :pcOraTyp;\n" \
8475  " EXEC SQL\n" \
8476  " fetch crsSlcDonGC\n" \
8477  " into: pClob: sInd;\n" \
8478  " }\n" \
8479  " else\n" \
8480  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur ouverture curseur : %s,%s,-%s-,-%s-\\n\", apcTyp, apcSource, apcEtab, apcObj));\n" \
8481  "\n" \
8482  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8483  "\n" \
8484  " /* Analyse du code resultat SQL */\n" \
8485  " if (((int4)GIV::GWCCodeOK != iIntRet) || (NULL == pClob))\n" \
8486  " GWTTrace(GWT_NIV_FONCT, (\"Erreur : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acOrdre_sql));\n" \
8487  "\n" \
8488  " iLgEcrit = 0;\n" \
8489  "\n" \
8490  " if (((int4)GIV::GWCCodeOK == iIntRet) && ((int4)GIV::GYBok == sInd))\n" \
8491  " {\n" \
8492  " /* lecture des données xmltype */\n" \
8493  " EXEC SQL\n" \
8494  " LOB\n" \
8495  " OPEN :pClob READ\n" \
8496  " ONLY;\n" \
8497  " givLectClob(pClob, apcEtab, apcObj, apcTyp, apcSource);\n" \
8498  " iLgEcrit = strlen(GIVBuffInter);\n" \
8499  " /* conversion du XMLType */\n" \
8500  " (void)givConvClob();\n" \
8501  " EXEC SQL\n" \
8502  " LOB\n" \
8503  " CLOSE: pClob;\n" \
8504  " }\n" \
8505  "\n" \
8506  " if (0 == strcmp(giv_HPN, apcSource))\n" \
8507  " {\n" \
8508  " EXEC SQL\n" \
8509  " close crsSlcDonDHNA;\n" \
8510  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8511  "\n" \
8512  " if ((int4)GIV::GYBok != iIntRet)\n" \
8513  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur close crsSlcDonDHNA: [COD=%d TXT=%s] %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcObj));\n" \
8514  " }\n" \
8515  " else if (0 == strcmp(giv_HGN, apcSource))\n" \
8516  " {\n" \
8517  " EXEC SQL\n" \
8518  " close crsSlcDonDHNE;\n" \
8519  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8520  "\n" \
8521  " if ((int4)GIV::GYBok != iIntRet)\n" \
8522  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur close crsSlcDonDHNE: [COD=%d TXT=%s] %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab));\n" \
8523  " }\n" \
8524  " else if (0 == strlen(apcEtab))\n" \
8525  " {\n" \
8526  " EXEC SQL\n" \
8527  " close crsSlcContAnnc;\n" \
8528  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8529  "\n" \
8530  " if ((int4)GIV::GYBok != iIntRet)\n" \
8531  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur close crsSlcContAnnc: [COD=%d TXT=%s] %s, %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcObj, apcTyp));\n" \
8532  " }\n" \
8533  " else if (0 == strcmp(giv_EPJ, apcSource))\n" \
8534  " {\n" \
8535  " EXEC SQL\n" \
8536  " close crsSlcContEtab;\n" \
8537  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8538  "\n" \
8539  " if ((int4)GIV::GYBok != iIntRet)\n" \
8540  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur close crsSlcContEtab: [COD=%d TXT=%s] %s, %s, %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab, apcObj, apcTyp));\n" \
8541  " }\n" \
8542  " else if (0 == strcmp(giv_ANO, apcSource))\n" \
8543  " {\n" \
8544  " EXEC SQL\n" \
8545  " close crsSlcContAnot;\n" \
8546  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8547  "\n" \
8548  " if ((int4)GIV::GYBok != iIntRet)\n" \
8549  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur close crsSlcContAnot: [COD=%d TXT=%s] %s, %s, %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab, apcObj, apcTyp));\n" \
8550  " }\n" \
8551  " else if (0 == strcmp(giv_ENR, apcSource))\n" \
8552  " {\n" \
8553  " EXEC SQL\n" \
8554  " close crsSlcDonEnr;\n" \
8555  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8556  "\n" \
8557  " if ((int4)GIV::GYBok != iIntRet)\n" \
8558  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur close crsSlcDonEnr: [COD=%d TXT=%s] %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab));\n" \
8559  " }\n" \
8560  " else if (0 == strcmp(giv_REL, apcSource))\n" \
8561  " {\n" \
8562  " EXEC SQL\n" \
8563  " close crsSlcDonRel;\n" \
8564  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8565  "\n" \
8566  " if ((int4)GIV::GYBok != iIntRet)\n" \
8567  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur close crsSlcDonRel: [COD=%d TXT=%s] %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab));\n" \
8568  " }\n" \
8569  " else if (0 == strcmp(giv_ADD, apcSource))\n" \
8570  " {\n" \
8571  " EXEC SQL\n" \
8572  " close crsSlcDonRes;\n" \
8573  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8574  "\n" \
8575  " if ((int4)GIV::GYBok != iIntRet)\n" \
8576  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur close crsSlcDonRes: [COD=%d TXT=%s] %s, %s\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab, apcTyp));\n" \
8577  " }\n" \
8578  " else if (0 == strcmp(giv_ADG, apcSource))\n" \
8579  " {\n" \
8580  " EXEC SQL\n" \
8581  " close crsSlcDonGC;\n" \
8582  " }\n" \
8583  " else\n" \
8584  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur fermeture curseur : %s,%s,-%s-,-%s-\\n\", apcTyp, apcSource, apcEtab, apcObj));\n" \
8585  "\n" \
8586  " GWTTrace(GWT_NIV_FONCT, (\"Liberation CLOB pour GYTtabPeEtab\\n\"));\n" \
8587  " /* liberation CLOB */\n" \
8588  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Liberation de CLOB\");\n" \
8589  " EXEC SQL\n" \
8590  " LOB FREE\n" \
8591  " TEMPORARY: pClob;\n" \
8592  " EXEC SQL\n" \
8593  " FREE: pClob;\n" \
8594  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8595  "\n" \
8596  " /* Analyse du code resultat SQL */\n" \
8597  " if ((int4)GIV::GYBok != iIntRet)\n" \
8598  " {\n" \
8599  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acOrdre_sql));\n" \
8600  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur libération Clob PeEtab\\n\"));\n" \
8601  " }\n" \
8602  "\n" \
8603  " GWTTrace(GWT_NIV_FONCT, (\"EtabDonSupp: %d, %s\\n\", strlen(GIVBuffInter), GIVBuffInter));\n" \
8604  " return (iCodRet);\n" \
8605  "}\n" \
8606  "\n" \
8607  "/*----------------------------------Fonction----------------------------------*\n" \
8608  " * Fonction : givLecturePartEtab\n" \
8609  " *\n" \
8610  " * But : données enrichies.\n" \
8611  " *\n" \
8612  " * Description : lecture\n" \
8613  " * dans la table GYTtabPartEtab.\n" \
8614  " *\n" \
8615  " *\n" \
8616  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
8617  "\n" \
8618  "int4 givLecturePartEtab(GYBrIapartT* apIapart, int4 aiClob)\n" \
8619  "{\n" \
8620  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
8621  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
8622  " EXEC SQL\n" \
8623  " begin declare\n" \
8624  " section;\n" \
8625  " static OCIClobLocator* pClob1;\n" \
8626  " static OCIClobLocator* pClob2;\n" \
8627  " static int2 sInd1I;\n" \
8628  " static int2 sInd2I;\n" \
8629  " OCIClobLocator* pClob;\n" \
8630  " char tcRequete[800];\n" \
8631  " nat8 length;\n" \
8632  " GYBrIapartT rIapart;\n" \
8633  " EXEC SQL\n" \
8634  " end declare\n" \
8635  " section;\n" \
8636  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
8637  " int4 iLgEcrit;\n" \
8638  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
8639  " iLgEcrit = 0;\n" \
8640  " GIVBuffInter[0] = '\\0';\n" \
8641  " iCodRet = (int4)GIV::GWCCodeOK;\n" \
8642  "\n" \
8643  " if ((int4)GIV::GWCCodeOK != iDejaPrepare)\n" \
8644  " {\n" \
8645  " (void)strcpy(vErreurSQL.acOrdre_sql, \"SlcPartEtab\");\n" \
8646  " (void)sprintf(tcRequete, GIV_SLC_CLOB_PART);\n" \
8647  " EXEC SQL\n" \
8648  " prepare rqtSlcPart\n" \
8649  " from: tcRequete;\n" \
8650  " EXEC SQL\n" \
8651  " DECLARE crsSlcPart\n" \
8652  " CURSOR FOR\n" \
8653  " rqtSlcPart;\n" \
8654  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
8655  " }\n" \
8656  "\n" \
8657  " if (GIV::GIXCodeOK == aiClob)\n" \
8658  " {\n" \
8659  " /* init CLOB PeEtab */\n" \
8660  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Allocate de CLOB1\");\n" \
8661  " sInd1I = (int4)GIV::GYBnok;\n" \
8662  " sInd2I = (int4)GIV::GYBnok;\n" \
8663  " EXEC SQL\n" \
8664  " ALLOCATE: pClob1;\n" \
8665  " EXEC SQL\n" \
8666  " LOB CREATE\n" \
8667  " TEMPORARY: pClob1;\n" \
8668  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8669  " GWTTrace(GWT_NIV_FONCT, (\"Allocation CLOB pour GYTtabPartEtab\\n\"));\n" \
8670  "\n" \
8671  " /* Analyse du code resultat SQL */\n" \
8672  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
8673  " {\n" \
8674  " iCodRet = iIntRet;\n" \
8675  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : [COD=%d TXT=%s]\\n\", iCodRet, vErreurSQL.acOrdre_sql));\n" \
8676  " return (iCodRet);\n" \
8677  " }\n" \
8678  "\n" \
8679  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Allocate de CLOB2\");\n" \
8680  " EXEC SQL\n" \
8681  " ALLOCATE: pClob2;\n" \
8682  " EXEC SQL\n" \
8683  " LOB CREATE\n" \
8684  " TEMPORARY: pClob2;\n" \
8685  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8686  " GWTTrace(GWT_NIV_FONCT, (\"Allocation CLOB pour GYTtabPartEtab\\n\"));\n" \
8687  "\n" \
8688  " /* Analyse du code resultat SQL */\n" \
8689  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
8690  " {\n" \
8691  " EXEC SQL\n" \
8692  " LOB FREE\n" \
8693  " TEMPORARY: pClob1;\n" \
8694  " EXEC SQL\n" \
8695  " FREE: pClob1;\n" \
8696  " iCodRet = iIntRet;\n" \
8697  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : [COD=%d TXT=%s]\\n\", iCodRet, vErreurSQL.acOrdre_sql));\n" \
8698  " return (iCodRet);\n" \
8699  " }\n" \
8700  "\n" \
8701  " (void)strcpy(rIapart.acOriPart, apIapart->acOriPart);\n" \
8702  " (void)strcpy(rIapart.acRefPart, apIapart->acRefPart);\n" \
8703  " GWTTrace(GWT_NIV_FONCT, (\"GYTtabPartEtab : %s,%s\\n\", apIapart->acOriPart, apIapart->acRefPart));\n" \
8704  " (void)strcpy(vErreurSQL.acOrdre_sql, \"SlcPartEtab\");\n" \
8705  " EXEC SQL\n" \
8706  " open crsSlcPart\n" \
8707  " using :rIapart.acOriPart, :rIapart.acRefPart;\n" \
8708  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8709  "\n" \
8710  " if ((int4)GIV::GYBok != iIntRet)\n" \
8711  " {\n" \
8712  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsSlcPart: [COD=%d TXT=%s] %s,%s\\n\", iIntRet, vErreurSQL.acDonnees_retour, rIapart.acOriPart, rIapart.acRefPart));\n" \
8713  " iCodRet = (int4)GIV::GWCCodeKO;\n" \
8714  " EXEC SQL\n" \
8715  " LOB FREE\n" \
8716  " TEMPORARY: pClob1;\n" \
8717  " EXEC SQL\n" \
8718  " FREE: pClob1;\n" \
8719  " EXEC SQL\n" \
8720  " LOB FREE\n" \
8721  " TEMPORARY: pClob2;\n" \
8722  " EXEC SQL\n" \
8723  " FREE: pClob2;\n" \
8724  " return (iCodRet);\n" \
8725  " }\n" \
8726  "\n" \
8727  " EXEC SQL\n" \
8728  " fetch crsSlcPart\n" \
8729  " into :pClob1:sInd1I, :pClob2:sInd2I;\n" \
8730  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8731  "\n" \
8732  " /* Analyse du code resultat SQL */\n" \
8733  " if (((int4)GIV::GWCCodeOK != iIntRet) || (((int4)GIV::GYBok != sInd1I) && ((int4)GIV::GYBok != sInd2I)))\n" \
8734  " {\n" \
8735  " iCodRet = (int4)GIV::GWCCodeKO;\n" \
8736  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acOrdre_sql));\n" \
8737  " EXEC SQL\n" \
8738  " close crsSlcPart;\n" \
8739  " EXEC SQL\n" \
8740  " LOB FREE\n" \
8741  " TEMPORARY: pClob1;\n" \
8742  " EXEC SQL\n" \
8743  " FREE: pClob1;\n" \
8744  " EXEC SQL\n" \
8745  " LOB FREE\n" \
8746  " TEMPORARY: pClob2;\n" \
8747  " EXEC SQL\n" \
8748  " FREE: pClob2;\n" \
8749  " return (iCodRet);\n" \
8750  " }\n" \
8751  " }\n" \
8752  "\n" \
8753  " if ((GIV::GIXCodeOK == aiClob) && ((int4)GIV::GYBok == sInd1I))\n" \
8754  " {\n" \
8755  " pClob = pClob1;\n" \
8756  " EXEC SQL\n" \
8757  " LOB\n" \
8758  " OPEN :pClob1 READ\n" \
8759  " ONLY;\n" \
8760  " }\n" \
8761  " else if ((GIV::GIXCodeOK != aiClob) && ((int4)GIV::GYBok == sInd2I))\n" \
8762  " {\n" \
8763  " pClob = pClob2;\n" \
8764  " EXEC SQL\n" \
8765  " LOB\n" \
8766  " OPEN :pClob2 READ\n" \
8767  " ONLY;\n" \
8768  " }\n" \
8769  " else\n" \
8770  " {\n" \
8771  " GWTTrace(GWT_NIV_FONCT, (\"Pas de donnée xmltype %d\\n\", aiClob));\n" \
8772  "\n" \
8773  " if (GIV::GIXCodeOK != aiClob)\n" \
8774  " {\n" \
8775  " EXEC SQL\n" \
8776  " close crsSlcPart;\n" \
8777  " EXEC SQL\n" \
8778  " LOB FREE\n" \
8779  " TEMPORARY: pClob1;\n" \
8780  " EXEC SQL\n" \
8781  " FREE: pClob1;\n" \
8782  " EXEC SQL\n" \
8783  " LOB FREE\n" \
8784  " TEMPORARY: pClob2;\n" \
8785  " EXEC SQL\n" \
8786  " FREE: pClob2;\n" \
8787  " }\n" \
8788  "\n" \
8789  " iCodRet = (int4)GIV::GWCCodeOK;\n" \
8790  " return (iCodRet);\n" \
8791  " }\n" \
8792  "\n" \
8793  " /* lecture des données xmltype */\n" \
8794  " givLectClob(pClob, apIapart->acOriPart, apIapart->acRefPart, giv_PRT, giv_PRT);\n" \
8795  " /* conversion du XMLType */\n" \
8796  " (void)givConvClob();\n" \
8797  " GIVBuffXML[0] = '\\0';\n" \
8798  " GWTTrace(GWT_NIV_FONCT, (\"PartEtab: %d, %s\\n\", strlen(GIVBuffInter), GIVBuffInter));\n" \
8799  "\n" \
8800  " if (GIV::GIXCodeOK == aiClob)\n" \
8801  " {\n" \
8802  " EXEC SQL\n" \
8803  " LOB\n" \
8804  " CLOSE: pClob1;\n" \
8805  " }\n" \
8806  " else if (GIV::GIXCodeOK != aiClob)\n" \
8807  " {\n" \
8808  " EXEC SQL\n" \
8809  " close crsSlcPart;\n" \
8810  " GWTTrace(GWT_NIV_FONCT, (\"Liberation CLOB pour GYTtabPartEtab\\n\"));\n" \
8811  " /* liberation CLOB */\n" \
8812  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Liberation de CLOB\");\n" \
8813  " EXEC SQL\n" \
8814  " LOB FREE\n" \
8815  " TEMPORARY: pClob1;\n" \
8816  " EXEC SQL\n" \
8817  " FREE: pClob1;\n" \
8818  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8819  "\n" \
8820  " /* Analyse du code resultat SQL */\n" \
8821  " if ((int4)GIV::GYBok != iIntRet)\n" \
8822  " {\n" \
8823  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acOrdre_sql));\n" \
8824  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur libération Clob PartEtab\\n\"));\n" \
8825  " }\n" \
8826  "\n" \
8827  " EXEC SQL\n" \
8828  " LOB\n" \
8829  " CLOSE: pClob2;\n" \
8830  " EXEC SQL\n" \
8831  " LOB FREE\n" \
8832  " TEMPORARY: pClob2;\n" \
8833  " EXEC SQL\n" \
8834  " FREE: pClob2;\n" \
8835  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8836  "\n" \
8837  " /* Analyse du code resultat SQL */\n" \
8838  " if ((int4)GIV::GYBok != iIntRet)\n" \
8839  " {\n" \
8840  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acOrdre_sql));\n" \
8841  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur libération Clob PartEtab\\n\"));\n" \
8842  " }\n" \
8843  " }\n" \
8844  "\n" \
8845  " return (iCodRet);\n" \
8846  "}\n" \
8847  "\n" \
8848  "/*----------------------------------Fonction----------------------------------*\n" \
8849  " * Fonction : givLectureEtabMC\n" \
8850  " *\n" \
8851  " * But : type de l'URL.\n" \
8852  " *\n" \
8853  " * Description : Lecture des données de niveau inscription\n" \
8854  " * dans la table GYTtabPeeatb.\n" \
8855  " *\n" \
8856  " *\n" \
8857  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
8858  "\n" \
8859  "int4 givLectureEtabMC(char* apcEtab, char acPar, char** buf_pos_in)\n" \
8860  "{\n" \
8861  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
8862  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
8863  " int1 indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
8864  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
8865  " int4 lg_ecr, iIdx, j;\n" \
8866  " char* buf_pos;\n" \
8867  " static char tcEtab[GYBIeinscLgEtab2] = \"\"; /* code etablissement */\n" \
8868  " EXEC SQL\n" \
8869  " begin declare\n" \
8870  " section;\n" \
8871  " static GYBrPeEtabT rEtab;\n" \
8872  " static GYBrIndPeEtabT rIndEtab;\n" \
8873  " static char tcCount[6];\n" \
8874  " EXEC SQL\n" \
8875  " end declare\n" \
8876  " section;\n" \
8877  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
8878  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
8879  " lg_ecr = 0;\n" \
8880  " buf_pos = *buf_pos_in;\n" \
8881  "\n" \
8882  " if (0 != strcmp(tcEtab, apcEtab))\n" \
8883  " {\n" \
8884  " /* changement d'etab */\n" \
8885  " strcpy(tcEtab, apcEtab);\n" \
8886  " strcpy(rEtab.acEtab, apcEtab);\n" \
8887  " strcpy(tcCount, \"00000\");\n" \
8888  " rIndEtab.copysLibUrlI(GIV::GYBnok);\n" \
8889  "\n" \
8890  " /* Traitement des erreurs SQL */\n" \
8891  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureEtabMC\");\n" \
8892  " EXEC SQL\n" \
8893  " OPEN crsLectureEtabMC\n" \
8894  " USING: rEtab.acEtab;\n" \
8895  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8896  "\n" \
8897  " if ((int4)GIV::GYBok != iIntRet)\n" \
8898  " {\n" \
8899  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureEtabMC: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
8900  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8901  " }\n" \
8902  "\n" \
8903  " if ((int4)GIV::GYBok == iIntRet)\n" \
8904  " {\n" \
8905  " EXEC SQL\n" \
8906  " FETCH crsLectureEtabMC\n" \
8907  " INTO\n" \
8908  " :rEtab.acSiret\n" \
8909  " :rIndEtab.sSiretI,\n" \
8910  " :rEtab.acLibUrl:rIndEtab.sLibUrlI,\n" \
8911  " :rEtab.acTefEt:rIndEtab.sTefEtI,\n" \
8912  " :rEtab.acTefEn:rIndEtab.sTefEnI,\n" \
8913  " :rEtab.acSiege:rIndEtab.sSiegeI,\n" \
8914  " :rEtab.acCJ:rIndEtab.sCJI,\n" \
8915  " :rEtab.acLibCJ:rIndEtab.sLibCJI,\n" \
8916  " :rEtab.acLibAPE:rIndEtab.sLibAPEI,\n" \
8917  " :rEtab.acDat:rIndEtab.sDatI;\n" \
8918  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8919  " }\n" \
8920  "\n" \
8921  " EXEC SQL\n" \
8922  " close crsLectureEtabMC;\n" \
8923  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8924  "\n" \
8925  " if ((int4)GIV::GYBok != iIntRet)\n" \
8926  " {\n" \
8927  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureEtabMC: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
8928  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8929  " }\n" \
8930  "\n" \
8931  " if ((int4)GIV::GYBok == rIndEtab.sSiretI)\n" \
8932  " {\n" \
8933  " /* utilisation de siren (9 car de siret) */\n" \
8934  " rEtab.acSiret[9] = '\\0';\n" \
8935  " /* Traitement des erreurs SQL */\n" \
8936  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureSiren\");\n" \
8937  " EXEC SQL\n" \
8938  " OPEN crsLectureSiren\n" \
8939  " USING: rEtab.acSiret;\n" \
8940  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8941  "\n" \
8942  " if ((int4)GIV::GYBok != iIntRet)\n" \
8943  " {\n" \
8944  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureSiren: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
8945  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8946  " }\n" \
8947  " else\n" \
8948  " {\n" \
8949  " EXEC SQL\n" \
8950  " FETCH crsLectureSiren\n" \
8951  " INTO: tcCount;\n" \
8952  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8953  " EXEC SQL\n" \
8954  " close crsLectureSiren;\n" \
8955  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
8956  "\n" \
8957  " if ((int4)GIV::GYBok != iIntRet)\n" \
8958  " {\n" \
8959  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureSiren: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
8960  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
8961  " }\n" \
8962  " }\n" \
8963  " }\n" \
8964  " }\n" \
8965  "\n" \
8966  " if ('0' == acPar)\n" \
8967  " {\n" \
8968  " rIndEtab.copyValues(GIV::GYBnok);\n" \
8969  " }\n" \
8970  "\n" \
8971  " if ((int4)GIV::GYBok == rIndEtab.sLibUrlI)\n" \
8972  " {\n" \
8973  " lg_ecr = giv_ecrit_balise(buf_pos, rEtab.acLibUrl, \"etaburl\");\n" \
8974  " buf_pos = buf_pos + lg_ecr;\n" \
8975  " }\n" \
8976  "\n" \
8977  " if ((int4)GIV::GYBok == rIndEtab.sTefEtI)\n" \
8978  " {\n" \
8979  " lg_ecr = giv_ecrit_balise(buf_pos, rEtab.acTefEt, \"eta_tefet\");\n" \
8980  " buf_pos = buf_pos + lg_ecr;\n" \
8981  " }\n" \
8982  "\n" \
8983  " if ((int4)GIV::GYBok == rIndEtab.sTefEnI)\n" \
8984  " {\n" \
8985  " lg_ecr = giv_ecrit_balise(buf_pos, rEtab.acTefEn, \"eta_tefen\");\n" \
8986  " buf_pos = buf_pos + lg_ecr;\n" \
8987  " }\n" \
8988  "\n" \
8989  " if (((int4)GIV::GYBok == rIndEtab.sSiegeI) && ('0' == rEtab.acSiege))\n" \
8990  " {\n" \
8991  " lg_ecr = giv_ecrit_balise(buf_pos, \"0\", \"eta_siege\");\n" \
8992  " buf_pos = buf_pos + lg_ecr;\n" \
8993  " }\n" \
8994  " else if ((int4)GIV::GYBok == rIndEtab.sSiegeI)\n" \
8995  " {\n" \
8996  " lg_ecr = giv_ecrit_balise(buf_pos, \"1\", \"eta_siege\");\n" \
8997  " buf_pos = buf_pos + lg_ecr;\n" \
8998  " }\n" \
8999  "\n" \
9000  " if ((int4)GIV::GYBok == rIndEtab.sCJI)\n" \
9001  " {\n" \
9002  " lg_ecr = giv_ecrit_balise(buf_pos, rEtab.acCJ, \"eta_cj\");\n" \
9003  " buf_pos = buf_pos + lg_ecr;\n" \
9004  " }\n" \
9005  "\n" \
9006  " if ((int4)GIV::GYBok == rIndEtab.sSiretI)\n" \
9007  " {\n" \
9008  " lg_ecr = giv_ecrit_balise(buf_pos, rEtab.acSiret, \"siren\");\n" \
9009  " buf_pos = buf_pos + lg_ecr;\n" \
9010  " lg_ecr = giv_ecrit_balise(buf_pos, tcCount, \"nbetsiren\");\n" \
9011  " buf_pos = buf_pos + lg_ecr;\n" \
9012  " }\n" \
9013  "\n" \
9014  " /* Ecriture dans le fichier de sortie */\n" \
9015  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
9016  "\n" \
9017  " if ((int4)GIV::GYBok == rIndEtab.sLibCJI)\n" \
9018  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rEtab.acLibCJ, \"eta_cjlib\");\n" \
9019  "\n" \
9020  " if ((int4)GIV::GYBok == rIndEtab.sLibAPEI)\n" \
9021  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rEtab.acLibAPE, \"libape\");\n" \
9022  "\n" \
9023  " if ((int4)GIV::GYBok == rIndEtab.sDatI)\n" \
9024  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rEtab.acDat, \"dtcreentr\");\n" \
9025  "\n" \
9026  " *buf_pos_in = buf_pos;\n" \
9027  " return (iCodRet);\n" \
9028  "}\n" \
9029  "\n" \
9030  "/*----------------------------------Fonction----------------------------------*\n" \
9031  " * Fonction : givLectureSynonyme\n" \
9032  " *\n" \
9033  " * But : synonymes de dénomination.\n" \
9034  " *\n" \
9035  " * Description : Lecture des données de niveau bloc\n" \
9036  " * dans la table GYTtabDenomSynonyme.\n" \
9037  " *\n" \
9038  " *\n" \
9039  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
9040  "\n" \
9041  "int4 givLectureSynonyme(GYBrDOCUMENTEpj* doc, char** buf_pos_in, int4 aiRang, int4 aIndice)\n" \
9042  "{\n" \
9043  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
9044  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
9045  " int1 indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
9046  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
9047  " char* buf_pos;\n" \
9048  " int4 lg_ecr;\n" \
9049  " int4 i, j;\n" \
9050  " int4 iDeb;\n" \
9051  " EXEC SQL\n" \
9052  " begin declare\n" \
9053  " section;\n" \
9054  " GYBrDenomSynoT rOraSyno;\n" \
9055  " EXEC SQL\n" \
9056  " end declare\n" \
9057  " section;\n" \
9058  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
9059  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
9060  " iDeb = 1;\n" \
9061  " buf_pos = *buf_pos_in;\n" \
9062  " strcpy(rOraSyno.acDenom, (doc + aiRang)->value.intitule.denomination);\n" \
9063  " /* Traitement des erreurs SQL */\n" \
9064  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureSyno\");\n" \
9065  " EXEC SQL\n" \
9066  " OPEN crsLectureSyno\n" \
9067  " USING: rOraSyno.acDenom;\n" \
9068  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9069  "\n" \
9070  " if ((int4)GIV::GYBok != iIntRet)\n" \
9071  " {\n" \
9072  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureSyno: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9073  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9074  " }\n" \
9075  "\n" \
9076  " if ((int4)GIV::GYBok == iIntRet)\n" \
9077  " {\n" \
9078  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
9079  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureSyno\");\n" \
9080  "\n" \
9081  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
9082  " {\n" \
9083  " EXEC SQL\n" \
9084  " FETCH crsLectureSyno\n" \
9085  " INTO\n" \
9086  " :rOraSyno.acCodan8,\n" \
9087  " :rOraSyno.acSyno;\n" \
9088  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9089  "\n" \
9090  " if ((int4)GIV::GYBok != iIntRet)\n" \
9091  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
9092  " else\n" \
9093  " {\n" \
9094  " GWTTrace(GWT_NIV_FONCT, (\"Syno : %s, %s\\n\", rOraSyno.acCodan8, rOraSyno.acSyno));\n" \
9095  "\n" \
9096  " for (i = 0; i < aIndice; i++)\n" \
9097  " {\n" \
9098  " if ((doc + aiRang)->value.intitule.iRgDnom == (doc + i)->value.intitule.iRgDnom)\n" \
9099  " {\n" \
9100  " for (j = 0; j < (doc + i)->value.rubriques.iNban9; j++)\n" \
9101  " {\n" \
9102  " if (0 == strcmp((doc + i)->value.rubriques.Tan9[j].val_codan8, rOraSyno.acCodan8))\n" \
9103  " break;\n" \
9104  " }\n" \
9105  "\n" \
9106  " if ((doc + i)->value.rubriques.iNban9 != j)\n" \
9107  " break;\n" \
9108  " }\n" \
9109  " }\n" \
9110  "\n" \
9111  " if (aIndice != i)\n" \
9112  " {\n" \
9113  " if (1 == iDeb)\n" \
9114  " {\n" \
9115  " lg_ecr = giv_ecrit_noeud_simple(buf_pos, \"synonymes\");\n" \
9116  " buf_pos = buf_pos + lg_ecr;\n" \
9117  " iDeb = 0;\n" \
9118  " }\n" \
9119  "\n" \
9120  " lg_ecr = giv_ecrit_balise_iso(buf_pos, rOraSyno.acSyno, \"synonyme\");\n" \
9121  " buf_pos = buf_pos + lg_ecr;\n" \
9122  " }\n" \
9123  " }\n" \
9124  " }\n" \
9125  " }\n" \
9126  "\n" \
9127  " if (1 != iDeb)\n" \
9128  " {\n" \
9129  " lg_ecr = giv_ecrit_fin_noeud(&buf_pos, \"synonymes\");\n" \
9130  " buf_pos = buf_pos + lg_ecr;\n" \
9131  " }\n" \
9132  "\n" \
9133  " EXEC SQL\n" \
9134  " close crsLectureSyno;\n" \
9135  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9136  "\n" \
9137  " if ((int4)GIV::GYBok != iIntRet)\n" \
9138  " {\n" \
9139  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureSyno: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9140  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9141  " }\n" \
9142  "\n" \
9143  " *buf_pos_in = buf_pos;\n" \
9144  " return (iCodRet);\n" \
9145  "}\n" \
9146  "\n" \
9147  "/*----------------------------------Fonction----------------------------------*\n" \
9148  " * Fonction : givLectureEmbauche\n" \
9149  " *\n" \
9150  " * But : ref d'Embauche\n" \
9151  " *\n" \
9152  " * Description : Lecture de ref\n" \
9153  " * dans la table GYTtabEmbauche.\n" \
9154  " *\n" \
9155  " *\n" \
9156  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
9157  "\n" \
9158  "int4 givLectureEmbauche(char* apcNumcli, char* apcRefext)\n" \
9159  "{\n" \
9160  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
9161  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
9162  " int1 indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
9163  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
9164  " int4 iIdx;\n" \
9165  " int4 j;\n" \
9166  " EXEC SQL\n" \
9167  " begin declare\n" \
9168  " section;\n" \
9169  " char* pcOraCli;\n" \
9170  " char pcOraRef[17 + 1];\n" \
9171  " int2 sIndic;\n" \
9172  " EXEC SQL\n" \
9173  " VAR pcOraCli\n" \
9174  " IS STRING;\n" \
9175  " EXEC SQL\n" \
9176  " VAR pcOraRef\n" \
9177  " IS STRING;\n" \
9178  " EXEC SQL\n" \
9179  " end declare\n" \
9180  " section;\n" \
9181  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
9182  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
9183  " pcOraCli = apcNumcli;\n" \
9184  " /* Traitement des erreurs SQL */\n" \
9185  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureEmbauche\");\n" \
9186  " EXEC SQL\n" \
9187  " OPEN crsLectureEmbauche\n" \
9188  " USING: pcOraCli;\n" \
9189  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9190  "\n" \
9191  " if ((int4)GIV::GYBok != iIntRet)\n" \
9192  " {\n" \
9193  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureEmbauche: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9194  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9195  " }\n" \
9196  "\n" \
9197  " apcRefext[0] = '\\0';\n" \
9198  "\n" \
9199  " if ((int4)GIV::GYBok == iIntRet)\n" \
9200  " {\n" \
9201  " EXEC SQL\n" \
9202  " FETCH crsLectureEmbauche\n" \
9203  " INTO: pcOraRef: sIndic;\n" \
9204  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9205  "\n" \
9206  " if (((int4)GIV::GYBok != iIntRet) || ((int4)GIV::GYBok != sIndic))\n" \
9207  " apcRefext[0] = '\\0';\n" \
9208  " else\n" \
9209  " (void)strcpy(&apcRefext[0], &pcOraRef[0]);\n" \
9210  " }\n" \
9211  "\n" \
9212  " EXEC SQL\n" \
9213  " close crsLectureEmbauche;\n" \
9214  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9215  "\n" \
9216  " if ((int4)GIV::GYBok != iIntRet)\n" \
9217  " {\n" \
9218  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureEmbauche: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9219  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9220  " }\n" \
9221  "\n" \
9222  " GWTTrace(GWT_NIV_FONCT, (\"Embauche: %s, %s\\n\", apcNumcli, apcRefext));\n" \
9223  " return (iCodRet);\n" \
9224  "}\n" \
9225  "\n" \
9226  "/*----------------------------------Fonction----------------------------------*\n" \
9227  " * Fonction : givLectureStat\n" \
9228  " *\n" \
9229  " * But : code statistique\n" \
9230  " *\n" \
9231  " * Description : Lecture de ref\n" \
9232  " * dans la table GYTtabEStatAn.\n" \
9233  " *\n" \
9234  " *\n" \
9235  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
9236  "\n" \
9237  "int4 givLectureStat(char* apcNumcli, char* apcStat)\n" \
9238  "{\n" \
9239  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
9240  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
9241  " int1 indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
9242  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
9243  " int4 iIdx;\n" \
9244  " int4 j;\n" \
9245  " EXEC SQL\n" \
9246  " begin declare\n" \
9247  " section;\n" \
9248  " char* pcOraCli;\n" \
9249  " char pcOraRef[100 + 1];\n" \
9250  " int2 sIndic;\n" \
9251  " EXEC SQL\n" \
9252  " VAR pcOraCli\n" \
9253  " IS STRING;\n" \
9254  " EXEC SQL\n" \
9255  " VAR pcOraRef\n" \
9256  " IS STRING;\n" \
9257  " EXEC SQL\n" \
9258  " end declare\n" \
9259  " section;\n" \
9260  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
9261  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
9262  " pcOraCli = apcNumcli;\n" \
9263  " /* Traitement des erreurs SQL */\n" \
9264  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureStat\");\n" \
9265  " EXEC SQL\n" \
9266  " OPEN crsLectureStat\n" \
9267  " USING: pcOraCli;\n" \
9268  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9269  "\n" \
9270  " if ((int4)GIV::GYBok != iIntRet)\n" \
9271  " {\n" \
9272  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureStat: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9273  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9274  " }\n" \
9275  "\n" \
9276  " apcStat[0] = '\\0';\n" \
9277  "\n" \
9278  " if ((int4)GIV::GYBok == iIntRet)\n" \
9279  " {\n" \
9280  " EXEC SQL\n" \
9281  " FETCH crsLectureStat\n" \
9282  " INTO: pcOraRef: sIndic;\n" \
9283  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9284  "\n" \
9285  " if (((int4)GIV::GYBok != iIntRet) || ((int4)GIV::GYBok != sIndic))\n" \
9286  " apcStat[0] = '\\0';\n" \
9287  " else\n" \
9288  " (void)strcpy(&apcStat[0], &pcOraRef[0]);\n" \
9289  " }\n" \
9290  "\n" \
9291  " EXEC SQL\n" \
9292  " close crsLectureStat;\n" \
9293  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9294  "\n" \
9295  " if ((int4)GIV::GYBok != iIntRet)\n" \
9296  " {\n" \
9297  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureStat: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9298  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9299  " }\n" \
9300  "\n" \
9301  " GWTTrace(GWT_NIV_FONCT, (\"Stat: %s, %s\\n\", apcNumcli, apcStat));\n" \
9302  " return (iCodRet);\n" \
9303  "}\n" \
9304  "\n" \
9305  "/*----------------------------------Fonction----------------------------------*\n" \
9306  " * Fonction : givEcritureMotsCles\n" \
9307  " *\n" \
9308  " * But : cri mots cles\n" \
9309  " *\n" \
9310  " * Description : criture temre de cri\n" \
9311  " * depuis la table GYTtabMotsClesCri.\n" \
9312  " *\n" \
9313  " *\n" \
9314  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
9315  "\n" \
9316  "int4 givEcritureMotsCles(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 iRef, int4 iObj, int4 indice, char* pcBalise)\n" \
9317  "{\n" \
9318  " char* buf_pos;\n" \
9319  " int4 iCodRet, iRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
9320  " char* pt_debut_liste, *pt_fin_liste, *pcFin;\n" \
9321  " int4 lg_write;\n" \
9322  " int4 i, j, k, iNbCRC, iDiff;\n" \
9323  " char* pt_fin_lst;\n" \
9324  " char* pt_debut;\n" \
9325  " char* pt_fin;\n" \
9326  " GYBrPrioCRCT rPrioCRC;\n" \
9327  " GYBstrMClesCriIdT tcIdMCle;\n" \
9328  " /* Pointeur sur debut du buffer */\n" \
9329  " buf_pos = *buf_pos_in;\n" \
9330  " GWTTrace(GWT_NIV_FONCT, (\"Critère Mot Clé écrit\\n\"));\n" \
9331  "\n" \
9332  " /* Ecriture dans le fichier de sortie */\n" \
9333  " if ('\\0' != GIVBuffXML[0])\n" \
9334  " {\n" \
9335  " /* Ecriture dans le fichier de sortie */\n" \
9336  " iRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
9337  " }\n" \
9338  "\n" \
9339  " *buf_pos_in = buf_pos;\n" \
9340  " /* conversion du XMLType de GIVBuffInter */\n" \
9341  " (void)givConvClob();\n" \
9342  " lg_write = giv_ecrit_noeud_simple(buf_pos, pcBalise);\n" \
9343  " buf_pos = buf_pos + lg_write;\n" \
9344  " strcat(buf_pos, \"<annonceur etablissement=\\\"\\\" id=\\\"\");\n" \
9345  " lg_write = strlen(buf_pos);\n" \
9346  " memcpy(buf_pos + lg_write, &(doc + iRef)->value.objets_pub.micro[iObj].id[4], 8);\n" \
9347  " *(buf_pos + lg_write + 8) = '\\0';\n" \
9348  " strcat(buf_pos, \"\\\">\");\n" \
9349  " lg_write = strlen(buf_pos);\n" \
9350  " *(buf_pos + lg_write) = SEPARE_LIGNE;\n" \
9351  " *(buf_pos + (lg_write + 1)) = LINE_FEED;\n" \
9352  " *(buf_pos + (lg_write + 2)) = '\\0';\n" \
9353  " buf_pos = (buf_pos + lg_write + 2);\n" \
9354  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"listMC\");\n" \
9355  " buf_pos = buf_pos + lg_write;\n" \
9356  " pt_fin_lst = GIVBuffClob + strlen(GIVBuffClob);\n" \
9357  "\n" \
9358  " for (pt_debut = GIVBuffClob; pt_debut < pt_fin_lst;)\n" \
9359  " {\n" \
9360  " pt_fin = strchr(pt_debut, '|');\n" \
9361  "\n" \
9362  " if (pt_fin == 0)\n" \
9363  " pt_fin = pt_fin_lst;\n" \
9364  "\n" \
9365  " /* analyse id */\n" \
9366  " memcpy(tcIdMCle, pt_debut, (pt_fin - pt_debut));\n" \
9367  " tcIdMCle[(pt_fin - pt_debut)] = '\\0';\n" \
9368  " GWTTrace(GWT_NIV_FONCT, (\"Critère Mot Clé écrit %s,%d\\n\", tcIdMCle, strlen(tcIdMCle)));\n" \
9369  " lg_write = giv_ecrit_element(buf_pos, \"idMC\", tcIdMCle);\n" \
9370  " buf_pos = buf_pos + lg_write;\n" \
9371  " pt_debut = pt_fin + 1;\n" \
9372  " }\n" \
9373  "\n" \
9374  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"listMC\");\n" \
9375  " buf_pos = buf_pos + lg_write;\n" \
9376  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"annotation\");\n" \
9377  " buf_pos = buf_pos + lg_write;\n" \
9378  " iNbCRC = giviNbCRC;\n" \
9379  " iRet = givAnalyseObjetXML(\"MO\", doc, GIVBuffInter, &buf_pos);\n" \
9380  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"annotation\");\n" \
9381  " buf_pos = buf_pos + lg_write;\n" \
9382  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"annonceur\");\n" \
9383  " buf_pos = buf_pos + lg_write;\n" \
9384  " /* Ecriture dans le fichier de sortie de l'annotation déjà en UTF8 */\n" \
9385  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
9386  "\n" \
9387  " if (giviNbCRC != iNbCRC)\n" \
9388  " {\n" \
9389  " iDiff = giviNbCRC - iNbCRC;\n" \
9390  "\n" \
9391  " for (i = 1; i < indice; i++)\n" \
9392  " {\n" \
9393  " for (k = 0; k < i; k++)\n" \
9394  " {\n" \
9395  " if (0 == strcmp((doc + i)->value.a_classer.etab, (doc + k)->value.a_classer.etab))\n" \
9396  " break;\n" \
9397  " }\n" \
9398  "\n" \
9399  " if (k == i)\n" \
9400  " {\n" \
9401  " for (j = 0; j < iDiff; j++)\n" \
9402  " {\n" \
9403  " (void)strcpy(rPrioCRC.acTpdsob, givrListCRC.trEltList[iNbCRC + j].acTpdsob);\n" \
9404  " (void)strcpy(rPrioCRC.acCodan8, givrListCRC.trEltList[iNbCRC + j].acCodan8);\n" \
9405  " (void)strcpy(rPrioCRC.acType, givrListCRC.trEltList[iNbCRC + j].acType);\n" \
9406  " (void)strcpy(rPrioCRC.acEtab, (doc + i)->value.a_classer.etab);\n" \
9407  " (void)strcpy(rPrioCRC.acCRC, givrListCRC.trEltList[iNbCRC + j].acCRC);\n" \
9408  " rPrioCRC.iPrioCRC = givrListCRC.trEltList[iNbCRC + j].iPrioCRC;\n" \
9409  " iRet = givAjoutListCRC(rPrioCRC);\n" \
9410  "\n" \
9411  " if ((int4)GIV::GIXCodeOK != iRet)\n" \
9412  " break;\n" \
9413  " }\n" \
9414  "\n" \
9415  " if ((int4)GIV::GIXCodeOK != iRet)\n" \
9416  " break;\n" \
9417  " }\n" \
9418  " }\n" \
9419  " }\n" \
9420  "\n" \
9421  " *buf_pos_in = buf_pos;\n" \
9422  " return (iCodRet);\n" \
9423  "}\n" \
9424  "\n" \
9425  "/*----------------------------------Fonction----------------------------------*\n" \
9426  " * Fonction : givEcritureBonPlan\n" \
9427  " *\n" \
9428  " * But : ref de Bon Plan\n" \
9429  " *\n" \
9430  " * Description : Lecture de ref\n" \
9431  " * dans la table GYTtabBonPlan.\n" \
9432  " *\n" \
9433  " *\n" \
9434  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
9435  "\n" \
9436  "int4 givEcritureBonPlan(char* apcEtab, char** buf_pos_in)\n" \
9437  "{\n" \
9438  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
9439  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
9440  " int1 indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
9441  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
9442  " int4 iIdx, lg_ecr;\n" \
9443  " int4 j;\n" \
9444  " char* buf_pos;\n" \
9445  " EXEC SQL\n" \
9446  " begin declare\n" \
9447  " section;\n" \
9448  " char tcEtab[GYBIeinscLgEtab2]; /* etab */\n" \
9449  " char tcNumcli[GYBIeinscLgNumcli2]; /* client */\n" \
9450  " char datfin[GYBIeinscLgDatmod + 1]; /* date fin */\n" \
9451  " char tcNb[6]; /* nombre */\n" \
9452  " char cTyp;\n" \
9453  " GYBrIamicT rOraIamic;\n" \
9454  " int2 sIndic;\n" \
9455  " EXEC SQL\n" \
9456  " VAR tcEtab\n" \
9457  " IS STRING;\n" \
9458  " EXEC SQL\n" \
9459  " VAR tcNb\n" \
9460  " IS STRING;\n" \
9461  " EXEC SQL\n" \
9462  " end declare\n" \
9463  " section;\n" \
9464  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
9465  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
9466  " (void)strcpy(tcEtab, apcEtab);\n" \
9467  " lg_ecr = 0;\n" \
9468  " /* Initialisation pointeur */\n" \
9469  " buf_pos = *buf_pos_in;\n" \
9470  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureBonPlanPub\");\n" \
9471  " EXEC SQL\n" \
9472  " OPEN crsLectureBonPlanPub\n" \
9473  " USING :tcEtab, :tcEtab;\n" \
9474  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9475  "\n" \
9476  " if ((int4)GIV::GYBok != iIntRet)\n" \
9477  " {\n" \
9478  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsLectureBonPlanPub: [COD=%d TXT=%s EPJ=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour, apcEtab));\n" \
9479  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9480  " }\n" \
9481  " else\n" \
9482  " {\n" \
9483  " /* accès via Objet Pub au BonPlan */\n" \
9484  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureBonPlanPub\");\n" \
9485  " EXEC SQL\n" \
9486  " FETCH crsLectureBonPlanPub\n" \
9487  " INTO\n" \
9488  " :tcEtab,:datfin:sIndic,:tcNb,:rOraIamic.acTpdsob,:cTyp,:tcNumcli;\n" \
9489  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9490  "\n" \
9491  " if ((int4)GIV::GYBok != iIntRet)\n" \
9492  " {\n" \
9493  " GWTTrace(GWT_NIV_FONCT, (\"Pas de Bon Plan sur objet pub client : %s\\n\", tcEtab));\n" \
9494  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9495  " }\n" \
9496  " else\n" \
9497  " GWTTrace(GWT_NIV_FONCT, (\"Bon Plan sur objet pub client : %s,%c,%c\\n\", tcEtab, tcNb, cTyp));\n" \
9498  " }\n" \
9499  "\n" \
9500  " EXEC SQL\n" \
9501  " close crsLectureBonPlanPub;\n" \
9502  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9503  "\n" \
9504  " if ((int4)GIV::GYBok != iIntRet)\n" \
9505  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureBonPlanPub: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9506  "\n" \
9507  " if ((int4)GIV::GIXCodeKO != iCodRet)\n" \
9508  " {\n" \
9509  " /* référence de BonPlan */\n" \
9510  " if ((int4)GIV::GYBok != sIndic)\n" \
9511  " (void)strcpy(datfin, \"\");\n" \
9512  "\n" \
9513  " GWTTrace(GWT_NIV_FONCT, (\"BonPlanPub: %s, %s, %s, %s\\n\", tcEtab, datfin, tcNb, rOraIamic.acTpdsob));\n" \
9514  " lg_ecr = giv_ecrit_balise(buf_pos, \"1\", \"bonplan\");\n" \
9515  " buf_pos = buf_pos + lg_ecr;\n" \
9516  " lg_ecr = giv_ecrit_balise(buf_pos, tcNb, \"nb_bonplan\");\n" \
9517  " buf_pos = buf_pos + lg_ecr;\n" \
9518  " lg_ecr = giv_ecrit_balise(buf_pos, datfin, \"bonplan_df\");\n" \
9519  " buf_pos = buf_pos + lg_ecr;\n" \
9520  " strcpy(buf_pos, \"<offre_bonplan etab=\");\n" \
9521  " strcat(buf_pos, \"\\\"\");\n" \
9522  " strcat(buf_pos, tcEtab);\n" \
9523  " strcat(buf_pos, \"\\\">\");\n" \
9524  " strcat(buf_pos, rOraIamic.acTpdsob);\n" \
9525  " strcat(buf_pos, \"</offre_bonplan>\");\n" \
9526  " lg_ecr = strlen(buf_pos);\n" \
9527  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
9528  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
9529  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
9530  " lg_ecr = lg_ecr + 2;\n" \
9531  " buf_pos = (buf_pos + lg_ecr);\n" \
9532  " *buf_pos_in = buf_pos;\n" \
9533  " }\n" \
9534  "\n" \
9535  " return (iCodRet);\n" \
9536  "}\n" \
9537  "\n" \
9538  "/*----------------------------------Fonction----------------------------------*\n" \
9539  " * Fonction : givServiceEtabSEO\n" \
9540  " *\n" \
9541  " * But : numcli\n" \
9542  " *\n" \
9543  " * Description : Lecture de présence\n" \
9544  " * dans la table GYTtabSEOService.\n" \
9545  " *\n" \
9546  " *\n" \
9547  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
9548  "\n" \
9549  "int4 givServiceEtabSEO(GYBrDOCUMENTEpj* doc, char* apInfo, char* apAvis)\n" \
9550  "{\n" \
9551  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
9552  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
9553  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
9554  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
9555  " EXEC SQL\n" \
9556  " begin declare\n" \
9557  " section;\n" \
9558  " GYBrIeinscT rInscrip;\n" \
9559  " char cOraInfo, cOraAvis;\n" \
9560  " EXEC SQL\n" \
9561  " end declare\n" \
9562  " section;\n" \
9563  " int4 i;\n" \
9564  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9565  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
9566  "\n" \
9567  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
9568  " return (iCodRet);\n" \
9569  "\n" \
9570  " (void)strcpy(rInscrip.acEtab, doc->value.a_classer.etab);\n" \
9571  " /* Traitement des erreurs SQL */\n" \
9572  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureSrvSEO\");\n" \
9573  " EXEC SQL\n" \
9574  " OPEN crsLectureSrvSEO\n" \
9575  " USING: rInscrip.acEtab;\n" \
9576  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9577  "\n" \
9578  " if ((int4)GIV::GYBok != iIntRet)\n" \
9579  " {\n" \
9580  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureSrvSEO: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9581  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9582  " }\n" \
9583  "\n" \
9584  " if ((int4)GIV::GYBok == iIntRet)\n" \
9585  " {\n" \
9586  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
9587  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureSrvSEO\");\n" \
9588  "\n" \
9589  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
9590  " {\n" \
9591  " EXEC SQL\n" \
9592  " FETCH crsLectureSrvSEO\n" \
9593  " INTO\n" \
9594  " :cOraInfo,:cOraAvis;\n" \
9595  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9596  "\n" \
9597  " if ((int4)GIV::GYBok != iIntRet)\n" \
9598  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
9599  " else\n" \
9600  " {\n" \
9601  " *apInfo = cOraInfo;\n" \
9602  " *apAvis = cOraAvis;\n" \
9603  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
9604  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
9605  " }\n" \
9606  " }\n" \
9607  " }\n" \
9608  "\n" \
9609  " EXEC SQL\n" \
9610  " close crsLectureSrvSEO;\n" \
9611  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9612  "\n" \
9613  " if ((int4)GIV::GYBok != iIntRet)\n" \
9614  " {\n" \
9615  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureSrvSEO: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9616  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9617  " }\n" \
9618  "\n" \
9619  " return (iCodRet);\n" \
9620  "}\n" \
9621  "\n" \
9622  "/*----------------------------------Fonction----------------------------------*\n" \
9623  " * Fonction : givDnomPrincEtab\n" \
9624  " *\n" \
9625  " * But : numcli\n" \
9626  " *\n" \
9627  " * Description : Lecture de meilleure pub via etab\n" \
9628  " * dans la table GYTtabIAMIC.\n" \
9629  " *\n" \
9630  " *\n" \
9631  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
9632  "\n" \
9633  "int4 givDnomPrincEtab(GYBrDOCUMENTEpj* doc, int4 indice)\n" \
9634  "{\n" \
9635  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
9636  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
9637  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
9638  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
9639  " EXEC SQL\n" \
9640  " begin declare\n" \
9641  " section;\n" \
9642  " GYBrIeinscT rInscrip;\n" \
9643  " char* pcVersion;\n" \
9644  " char cDepart[GYBIeinscLgDeppar + 1];\n" \
9645  " char rOraTri[40];\n" \
9646  " int4 iVolee;\n" \
9647  " char tcBlocid[28 + 1];\n" \
9648  " int2 indic;\n" \
9649  " EXEC SQL\n" \
9650  " VAR rOraTri\n" \
9651  " IS STRING;\n" \
9652  " EXEC SQL\n" \
9653  " VAR tcBlocid\n" \
9654  " IS STRING;\n" \
9655  " EXEC SQL\n" \
9656  " end declare\n" \
9657  " section;\n" \
9658  " char rTri[38];\n" \
9659  " int4 i, iRang;\n" \
9660  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9661  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
9662  " (void)strcpy(rInscrip.acEtab, doc->value.a_classer.etab);\n" \
9663  " iRang = -1;\n" \
9664  " /* Traitement des erreurs SQL */\n" \
9665  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureDnomPrinc\");\n" \
9666  " EXEC SQL\n" \
9667  " OPEN crsLectureDnomPrinc\n" \
9668  " USING: rInscrip.acEtab;\n" \
9669  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9670  "\n" \
9671  " if ((int4)GIV::GYBok != iIntRet)\n" \
9672  " {\n" \
9673  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureDnomPrinc: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9674  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9675  " }\n" \
9676  "\n" \
9677  " if ((int4)GIV::GYBok == iIntRet)\n" \
9678  " {\n" \
9679  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
9680  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureDnomPrinc\");\n" \
9681  "\n" \
9682  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
9683  " {\n" \
9684  " EXEC SQL\n" \
9685  " FETCH crsLectureDnomPrinc\n" \
9686  " INTO: rOraTri;\n" \
9687  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9688  "\n" \
9689  " if ((int4)GIV::GYBok != iIntRet)\n" \
9690  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
9691  " else\n" \
9692  " {\n" \
9693  " GWTTrace(GWT_NIV_FONCT, (\" DnomPrinc... %s\\n\", rOraTri));\n" \
9694  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
9695  "\n" \
9696  " for (i = 0; i < indice; i++)\n" \
9697  " {\n" \
9698  " if (0 != strcmp((doc + i)->value.inscription[0].val_lslo, \"0000\"))\n" \
9699  " (void)strcpy(rTri, \"0\");\n" \
9700  " else\n" \
9701  " (void)strcpy(rTri, \"1\");\n" \
9702  "\n" \
9703  " (void)strcpy(rTri, (doc + i)->value.inscription[0].val_num);\n" \
9704  " (void)strcat(rTri, (doc + i)->value.inscription[0].val_lols);\n" \
9705  " (void)strcat(rTri, (doc + i)->value.inscription[0].val_lslo);\n" \
9706  " GWTTrace(GWT_NIV_FONCT, (\" DnomPrinc Doc ... %s\\n\", rTri));\n" \
9707  "\n" \
9708  " if (0 == strcmp(&rOraTri[21], rTri))\n" \
9709  " break;\n" \
9710  " }\n" \
9711  "\n" \
9712  " if (indice == i)\n" \
9713  " iRang = -1;\n" \
9714  " else\n" \
9715  " iRang = i;\n" \
9716  "\n" \
9717  " GWTTrace(GWT_NIV_FONCT, (\" DnomPrinc Rang ... %s,%d\\n\", rOraTri, iRang));\n" \
9718  " }\n" \
9719  " }\n" \
9720  " }\n" \
9721  "\n" \
9722  " EXEC SQL\n" \
9723  " close crsLectureDnomPrinc;\n" \
9724  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9725  "\n" \
9726  " if ((int4)GIV::GYBok != iIntRet)\n" \
9727  " {\n" \
9728  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureDnomPrinc: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9729  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9730  " }\n" \
9731  "\n" \
9732  " if (-1 != iRang)\n" \
9733  " {\n" \
9734  " indic = -1;\n" \
9735  " (void)strcpy(rInscrip.acNumnat, (doc + iRang)->value.inscription[0].val_num);\n" \
9736  " (void)strcpy(rInscrip.acNumlo, (doc + iRang)->value.inscription[0].val_lo);\n" \
9737  " (void)strcpy(rInscrip.acNumls, (doc + iRang)->value.inscription[0].val_ls);\n" \
9738  " (doc + iRang)->value.numero_bloc_parution_ref[0] = '\\0';\n" \
9739  " (void)strcpy(vErreurSQL.acOrdre_sql, \"crsVersSeo\");\n" \
9740  " EXEC SQL open crsVersSEO using :rInscrip.acNumnat, :rInscrip.acNumlo, :rInscrip.acNumls;\n" \
9741  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9742  "\n" \
9743  " if ((int4)GIV::GYBok != iIntRet)\n" \
9744  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsVersSeo pour blocid principal : [COD=%d TXT=%s],%s,%s,%s\\n\", iIntRet, vErreurSQL.acDonnees_retour, rInscrip.acNumnat, rInscrip.acNumlo, rInscrip.acNumls));\n" \
9745  " else\n" \
9746  " {\n" \
9747  " EXEC SQL\n" \
9748  " fetch crsVersSEO\n" \
9749  " into: tcBlocid: indic;\n" \
9750  "\n" \
9751  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9752  "\n" \
9753  " if (((int4)GIV::GYBok != iIntRet) || (0 != indic))\n" \
9754  " {\n" \
9755  " (doc + iRang)->value.numero_bloc_parution_ref[0] = '\\0';\n" \
9756  " GWTTrace(GWT_NIV_GRAVE, (\"Absence de blocidlr pour ippal : %s,%s,%s et epj : %s\\n\", rInscrip.acNumnat, rInscrip.acNumlo, rInscrip.acNumls, rInscrip.acEtab));\n" \
9757  " }\n" \
9758  " else\n" \
9759  " {\n" \
9760  " strcpy((doc + iRang)->value.numero_bloc_parution_ref, &tcBlocid[1]);\n" \
9761  "\n" \
9762  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
9763  " strcat((doc + iRang)->value.numero_bloc_parution_ref, \"C0002\");\n" \
9764  " else\n" \
9765  " strcat((doc + iRang)->value.numero_bloc_parution_ref, \"C0001\");\n" \
9766  " }\n" \
9767  "\n" \
9768  " EXEC SQL\n" \
9769  " close crsVersSEO;\n" \
9770  " }\n" \
9771  " }\n" \
9772  "\n" \
9773  " return (iRang);\n" \
9774  "}\n" \
9775  "\n" \
9776  "/*----------------------------------Fonction----------------------------------*\n" \
9777  " * Fonction : givExtraLocIS\n" \
9778  " *\n" \
9779  " * But : numcli\n" \
9780  " *\n" \
9781  " * Description : Lecture de ligne locale via etab, activité\n" \
9782  " *\n" \
9783  " *\n" \
9784  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
9785  "\n" \
9786  "int4 givExtraLocIS(char* apcEtab, char* apcCodAn8)\n" \
9787  "{\n" \
9788  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
9789  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
9790  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
9791  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
9792  " EXEC SQL\n" \
9793  " begin declare\n" \
9794  " section;\n" \
9795  " GYBrIeinscT rInscrip;\n" \
9796  " GYBrIaprofT rIaprof;\n" \
9797  " EXEC SQL\n" \
9798  " end declare\n" \
9799  " section;\n" \
9800  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
9801  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
9802  "\n" \
9803  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
9804  " {\n" \
9805  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9806  " return (iCodRet);\n" \
9807  " }\n" \
9808  "\n" \
9809  " (void)strcpy(rInscrip.acEtab, apcEtab);\n" \
9810  " (void)strcpy(rIaprof.acCodan8, apcCodAn8);\n" \
9811  " /* Traitement des erreurs SQL */\n" \
9812  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureExtraLocIS\");\n" \
9813  " EXEC SQL\n" \
9814  " OPEN crsLectureExtraLocIS\n" \
9815  " USING :rIaprof.acCodan8,\n" \
9816  " :rInscrip.acEtab,\n" \
9817  " :rInscrip.acEtab,\n" \
9818  " :rIaprof.acCodan8;\n" \
9819  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9820  "\n" \
9821  " if ((int4)GIV::GYBok != iIntRet)\n" \
9822  " {\n" \
9823  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureExtraLocIS %s: [COD=%d TXT=%s]\\n\", rIaprof.acCodan8, iIntRet, vErreurSQL.acDonnees_retour));\n" \
9824  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9825  " }\n" \
9826  "\n" \
9827  " if ((int4)GIV::GYBok == iIntRet)\n" \
9828  " {\n" \
9829  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
9830  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureExtraLocIS\");\n" \
9831  "\n" \
9832  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
9833  " {\n" \
9834  " EXEC SQL\n" \
9835  " FETCH crsLectureExtraLocIS\n" \
9836  " INTO: rIaprof.acCodan8;\n" \
9837  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9838  "\n" \
9839  " if ((int4)GIV::GYBok != iIntRet)\n" \
9840  " {\n" \
9841  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
9842  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9843  " }\n" \
9844  " else\n" \
9845  " {\n" \
9846  " GWTTrace(GWT_NIV_FONCT, (\" ExtraLocIS... %s\\n\", rIaprof.acCodan8));\n" \
9847  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
9848  " }\n" \
9849  " }\n" \
9850  " }\n" \
9851  "\n" \
9852  " GWTTrace(GWT_NIV_FONCT, (\" ExtraLocIS... %d\\n\", iCodRet));\n" \
9853  " EXEC SQL\n" \
9854  " close crsLectureExtraLocIS;\n" \
9855  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9856  "\n" \
9857  " if ((int4)GIV::GYBok != iIntRet)\n" \
9858  " {\n" \
9859  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureExtraLocIS: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9860  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9861  " }\n" \
9862  "\n" \
9863  " return (iCodRet);\n" \
9864  "}\n" \
9865  "int4 givExtraLocInterIS(char* apcEtab, char* apcCodAn8, GYBrDOCUMENTEpj* docIG, int4 indice)\n" \
9866  "{\n" \
9867  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
9868  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
9869  " int4 i, j;\n" \
9870  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
9871  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
9872  " EXEC SQL\n" \
9873  " begin declare\n" \
9874  " section;\n" \
9875  " GYBrIeinscT rInscrip;\n" \
9876  " GYBrIaprofT rIaprof;\n" \
9877  " EXEC SQL\n" \
9878  " end declare\n" \
9879  " section;\n" \
9880  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
9881  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
9882  "\n" \
9883  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
9884  " {\n" \
9885  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9886  " return (iCodRet);\n" \
9887  " }\n" \
9888  "\n" \
9889  " (void)strcpy(rInscrip.acEtab, apcEtab);\n" \
9890  " (void)strcpy(rIaprof.acCodan8, apcCodAn8);\n" \
9891  " /* Traitement des erreurs SQL */\n" \
9892  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureExtraLocInterIS\");\n" \
9893  " EXEC SQL\n" \
9894  " OPEN crsLectureExtraLocInterIS\n" \
9895  " USING :rIaprof.acCodan8,\n" \
9896  " :rInscrip.acEtab,\n" \
9897  " :rInscrip.acEtab,\n" \
9898  " :rIaprof.acCodan8;\n" \
9899  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9900  "\n" \
9901  " if ((int4)GIV::GYBok != iIntRet)\n" \
9902  " {\n" \
9903  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureExtraLocInterIS %s: [COD=%d TXT=%s]\\n\", rIaprof.acCodan8, iIntRet, vErreurSQL.acDonnees_retour));\n" \
9904  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9905  " }\n" \
9906  "\n" \
9907  " if ((int4)GIV::GYBok == iIntRet)\n" \
9908  " {\n" \
9909  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
9910  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureExtraLocInterIS\");\n" \
9911  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9912  "\n" \
9913  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
9914  " {\n" \
9915  " EXEC SQL\n" \
9916  " FETCH crsLectureExtraLocInterIS\n" \
9917  " INTO\n" \
9918  " :rInscrip.acNumnat,\n" \
9919  " :rInscrip.acNumlo,\n" \
9920  " :rInscrip.acNumls;\n" \
9921  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9922  "\n" \
9923  " if ((int4)GIV::GYBok != iIntRet)\n" \
9924  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
9925  " else\n" \
9926  " {\n" \
9927  " GWTTrace(GWT_NIV_FONCT, (\" ExtraLocInterIS... %s,%s,%s\\n\", rInscrip.acNumnat, rInscrip.acNumlo, rInscrip.acNumls));\n" \
9928  "\n" \
9929  " for (i = 0; i < indice; i++)\n" \
9930  " {\n" \
9931  " GWTTrace(GWT_NIV_FONCT, (\" ExtraLocInterIS... %s,%s,%s\\n\", (docIG + i)->value.inscription[0].val_num, (docIG + i)->value.inscription[0].val_lols, (docIG + i)->value.inscription[0].val_lslo));\n" \
9932  "\n" \
9933  " if ((0 == strcmp((docIG + i)->value.inscription[0].val_num, rInscrip.acNumnat)) && (0 == strcmp((docIG + i)->value.inscription[0].val_lols, rInscrip.acNumlo))\n" \
9934  " && (0 == strcmp((docIG + i)->value.inscription[0].val_lslo, rInscrip.acNumls)))\n" \
9935  " {\n" \
9936  " /* inscription trouvée dans le bloc */\n" \
9937  " break;\n" \
9938  " }\n" \
9939  " }\n" \
9940  "\n" \
9941  " if (indice != i)\n" \
9942  " {\n" \
9943  " /* inscription trouvée dans le bloc */\n" \
9944  " continue;\n" \
9945  " }\n" \
9946  "\n" \
9947  " /* inscription non trouvée dans le bloc */\n" \
9948  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
9949  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
9950  " }\n" \
9951  " }\n" \
9952  " }\n" \
9953  "\n" \
9954  " GWTTrace(GWT_NIV_FONCT, (\" ExtraLocInterIS... %d\\n\", iCodRet));\n" \
9955  " EXEC SQL\n" \
9956  " close crsLectureExtraLocInterIS;\n" \
9957  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
9958  "\n" \
9959  " if ((int4)GIV::GYBok != iIntRet)\n" \
9960  " {\n" \
9961  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureExtraLocInterIS: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
9962  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
9963  " }\n" \
9964  "\n" \
9965  " return (iCodRet);\n" \
9966  "}\n" \
9967  "\n" \
9968  "/*----------------------------------Fonction----------------------------------*\n" \
9969  " * Fonction : givExtraLocIO\n" \
9970  " *\n" \
9971  " * But : numcli\n" \
9972  " *\n" \
9973  " * Description : Lecture de ligne locale via etab, activité\n" \
9974  " *\n" \
9975  " *\n" \
9976  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
9977  "\n" \
9978  "int4 givExtraLocIO(GYBrDOCUMENTEpj* doc)\n" \
9979  "{\n" \
9980  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
9981  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
9982  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
9983  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
9984  " EXEC SQL\n" \
9985  " begin declare\n" \
9986  " section;\n" \
9987  " GYBrIeinscT rInscrip;\n" \
9988  " GYBrIaprofT rIaprof;\n" \
9989  " EXEC SQL\n" \
9990  " end declare\n" \
9991  " section;\n" \
9992  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
9993  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
9994  "\n" \
9995  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
9996  " return (iCodRet);\n" \
9997  "\n" \
9998  " (void)strcpy(rInscrip.acEtab, doc->value.a_classer.etab);\n" \
9999  " (void)strcpy(rInscrip.acNumnat, doc->value.inscription[0].val_num);\n" \
10000  " (void)strcpy(rInscrip.acNumlo, doc->value.inscription[0].val_lo);\n" \
10001  " (void)strcpy(rInscrip.acNumls, doc->value.inscription[0].val_ls);\n" \
10002  " /* Traitement des erreurs SQL */\n" \
10003  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureExtraLocIO\");\n" \
10004  " EXEC SQL\n" \
10005  " OPEN crsLectureExtraLocIO\n" \
10006  " USING :rInscrip.acEtab,\n" \
10007  " :rInscrip.acNumnat,\n" \
10008  " :rInscrip.acNumlo,\n" \
10009  " :rInscrip.acNumls,\n" \
10010  " :rInscrip.acEtab,\n" \
10011  " :rInscrip.acNumnat,\n" \
10012  " :rInscrip.acNumlo,\n" \
10013  " :rInscrip.acNumls,\n" \
10014  " :rInscrip.acEtab;\n" \
10015  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10016  "\n" \
10017  " if ((int4)GIV::GYBok != iIntRet)\n" \
10018  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureExtraLocIO %s: [COD=%d TXT=%s]\\n\", rIaprof.acCodan8, iIntRet, vErreurSQL.acDonnees_retour));\n" \
10019  "\n" \
10020  " if ((int4)GIV::GYBok == iIntRet)\n" \
10021  " {\n" \
10022  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
10023  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureExtraLocIO\");\n" \
10024  "\n" \
10025  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
10026  " {\n" \
10027  " EXEC SQL\n" \
10028  " FETCH crsLectureExtraLocIO\n" \
10029  " INTO: rIaprof.acCodan8;\n" \
10030  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10031  "\n" \
10032  " if ((int4)GIV::GYBok != iIntRet)\n" \
10033  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10034  " else\n" \
10035  " {\n" \
10036  " GWTTrace(GWT_NIV_FONCT, (\" ExtraLocIO... %s\\n\", rIaprof.acCodan8));\n" \
10037  " iCodRet = givExtraLocIS(doc->value.a_classer.etab, rIaprof.acCodan8);\n" \
10038  "\n" \
10039  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
10040  " {\n" \
10041  " /* existence de locale */\n" \
10042  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10043  " }\n" \
10044  " }\n" \
10045  " }\n" \
10046  " }\n" \
10047  "\n" \
10048  " GWTTrace(GWT_NIV_FONCT, (\" ExtraLocIO... %d\\n\", iCodRet));\n" \
10049  " EXEC SQL\n" \
10050  " close crsLectureExtraLocIO;\n" \
10051  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10052  "\n" \
10053  " if ((int4)GIV::GYBok != iIntRet)\n" \
10054  " {\n" \
10055  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureExtraLocIO: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10056  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
10057  " }\n" \
10058  "\n" \
10059  " return (iCodRet);\n" \
10060  "}\n" \
10061  "\n" \
10062  "/*----------------------------------Fonction----------------------------------*\n" \
10063  " * Fonction : givOppositionPart\n" \
10064  " *\n" \
10065  " * But : numcli\n" \
10066  " *\n" \
10067  " * Description : Lecture de la liste d'opposition\n" \
10068  " * d'une référence de partenaire.\n" \
10069  " *\n" \
10070  " *\n" \
10071  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
10072  "\n" \
10073  "int4 givOppositionPart(char** buf, char* val)\n" \
10074  "{\n" \
10075  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
10076  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
10077  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
10078  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
10079  " EXEC SQL\n" \
10080  " begin declare\n" \
10081  " section;\n" \
10082  " GYBrIapartT rIapart;\n" \
10083  " char rOraOpp[16];\n" \
10084  " EXEC SQL\n" \
10085  " VAR rOraOpp\n" \
10086  " IS STRING;\n" \
10087  " EXEC SQL\n" \
10088  " end declare\n" \
10089  " section;\n" \
10090  " int4 pipe;\n" \
10091  " int4 lg_write = 0;\n" \
10092  " char* buf_pos;\n" \
10093  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
10094  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
10095  " pipe = 0;\n" \
10096  " buf_pos = *buf;\n" \
10097  " (void)strcpy(rIapart.acOriPart, &val[strlen(val) - 4]);\n" \
10098  " (void)memcpy(rIapart.acRefPart, val, strlen(val) - 4);\n" \
10099  " rIapart.acRefPart[strlen(val) - 4] = '\\0';\n" \
10100  " /* Traitement des erreurs SQL */\n" \
10101  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureOppPart\");\n" \
10102  " EXEC SQL\n" \
10103  " OPEN crsLectureOppPart\n" \
10104  " USING :rIapart.acOriPart,\n" \
10105  " :rIapart.acRefPart;\n" \
10106  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10107  "\n" \
10108  " if ((int4)GIV::GYBok != iIntRet)\n" \
10109  " {\n" \
10110  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureOppPart %s,%s: [COD=%d TXT=%s]\\n\", rIapart.acOriPart, rIapart.acRefPart, iIntRet, vErreurSQL.acDonnees_retour));\n" \
10111  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10112  " }\n" \
10113  "\n" \
10114  " if ((int4)GIV::GYBok == iIntRet)\n" \
10115  " {\n" \
10116  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
10117  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureOppPart\");\n" \
10118  " GWTTrace(GWT_NIV_FONCT, (\" Opposition Partenaire... %s,%s\\n\", rIapart.acOriPart, rIapart.acRefPart));\n" \
10119  "\n" \
10120  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
10121  " {\n" \
10122  " EXEC SQL\n" \
10123  " FETCH crsLectureOppPart\n" \
10124  " INTO: rOraOpp;\n" \
10125  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10126  "\n" \
10127  " if ((int4)GIV::GYBok != iIntRet)\n" \
10128  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10129  " else\n" \
10130  " {\n" \
10131  " GWTTrace(GWT_NIV_FONCT, (\"%s\\n\", rOraOpp));\n" \
10132  " lg_write = giv_ecrit_balise(buf_pos, rOraOpp, \"opp_part\");\n" \
10133  " buf_pos = buf_pos + lg_write;\n" \
10134  " pipe = 1;\n" \
10135  " }\n" \
10136  " }\n" \
10137  " }\n" \
10138  "\n" \
10139  " *buf = buf_pos;\n" \
10140  " EXEC SQL\n" \
10141  " close crsLectureOppPart;\n" \
10142  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10143  "\n" \
10144  " if ((int4)GIV::GYBok != iIntRet)\n" \
10145  " {\n" \
10146  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureOppPart: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10147  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10148  " }\n" \
10149  "\n" \
10150  " return (iCodRet);\n" \
10151  "}\n" \
10152  "\n" \
10153  "/*----------------------------------Fonction----------------------------------*\n" \
10154  " * Fonction : givOppositionURLGratuite\n" \
10155  " *\n" \
10156  " * But : numcli\n" \
10157  " *\n" \
10158  " * Description : Lecture de l'ooposition sur le fichier GS lié à l'URL Gratuite\n" \
10159  " * dans la table GYTTabURLGrOpp.\n" \
10160  " *\n" \
10161  " *\n" \
10162  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
10163  "\n" \
10164  "int4 givOppositionURLGratuite(char* apcEtab, char* apcCodAn8)\n" \
10165  "{\n" \
10166  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
10167  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
10168  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
10169  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
10170  " EXEC SQL\n" \
10171  " begin declare\n" \
10172  " section;\n" \
10173  " GYBrIeinscT rInscrip;\n" \
10174  " GYBrIaprofT rIaprof;\n" \
10175  " EXEC SQL\n" \
10176  " end declare\n" \
10177  " section;\n" \
10178  " int4 i;\n" \
10179  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10180  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
10181  "\n" \
10182  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
10183  " return (iCodRet);\n" \
10184  "\n" \
10185  " (void)strcpy(rInscrip.acEtab, apcEtab);\n" \
10186  " (void)strcpy(rIaprof.acCodan8, apcCodAn8);\n" \
10187  " /* Traitement des erreurs SQL */\n" \
10188  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureOppURLGr\");\n" \
10189  " EXEC SQL\n" \
10190  " OPEN crsLectureOppURLGr\n" \
10191  " USING :rInscrip.acEtab,\n" \
10192  " :rIaprof.acCodan8;\n" \
10193  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10194  "\n" \
10195  " if ((int4)GIV::GYBok != iIntRet)\n" \
10196  " {\n" \
10197  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureOppURLGr %s: [COD=%d TXT=%s]\\n\", rIaprof.acCodan8, iIntRet, vErreurSQL.acDonnees_retour));\n" \
10198  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10199  " }\n" \
10200  "\n" \
10201  " if ((int4)GIV::GYBok == iIntRet)\n" \
10202  " {\n" \
10203  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
10204  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureOppURLGr\");\n" \
10205  " GWTTrace(GWT_NIV_FONCT, (\" OppURLGr... %s,%s\\n\", rIaprof.acCodan8, rInscrip.acEtab));\n" \
10206  "\n" \
10207  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
10208  " {\n" \
10209  " EXEC SQL\n" \
10210  " FETCH crsLectureOppURLGr\n" \
10211  " INTO: rIaprof.acCodan8;\n" \
10212  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10213  "\n" \
10214  " if ((int4)GIV::GYBok != iIntRet)\n" \
10215  " {\n" \
10216  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10217  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10218  " }\n" \
10219  " else\n" \
10220  " {\n" \
10221  " /* sortie sur opposition trouvée */\n" \
10222  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10223  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
10224  " }\n" \
10225  " }\n" \
10226  " }\n" \
10227  "\n" \
10228  " EXEC SQL\n" \
10229  " close crsLectureOppURLGr;\n" \
10230  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10231  "\n" \
10232  " if ((int4)GIV::GYBok != iIntRet)\n" \
10233  " {\n" \
10234  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureOppURLGr: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10235  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10236  " }\n" \
10237  "\n" \
10238  " return (iCodRet);\n" \
10239  "}\n" \
10240  "\n" \
10241  "/*----------------------------------Fonction----------------------------------*\n" \
10242  " * Fonction : givLectureBListCRCLR\n" \
10243  " *\n" \
10244  " * But : numcli\n" \
10245  " *\n" \
10246  " * Description : Lecture du black-listage en liste réponse\n" \
10247  " * dans la table GYTTabBListCRCLR.\n" \
10248  " *\n" \
10249  " *\n" \
10250  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
10251  "\n" \
10252  "int4 givLectureBListCRCLR(GYBrPrioCRCT* aprPrioCRC)\n" \
10253  "{\n" \
10254  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
10255  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
10256  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
10257  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
10258  " EXEC SQL\n" \
10259  " begin declare\n" \
10260  " section;\n" \
10261  " GYBrPrioCRCT rPrioCRC;\n" \
10262  " EXEC SQL\n" \
10263  " end declare\n" \
10264  " section;\n" \
10265  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10266  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
10267  "\n" \
10268  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
10269  " return (iCodRet);\n" \
10270  "\n" \
10271  " /* variables Oracle */\n" \
10272  " (void)strcpy(rPrioCRC.acEtab, aprPrioCRC->acEtab);\n" \
10273  " (void)strcpy(rPrioCRC.acCodan8, aprPrioCRC->acCodan8);\n" \
10274  " (void)strcpy(rPrioCRC.acTpdsob, aprPrioCRC->acTpdsob);\n" \
10275  " (void)strcpy(rPrioCRC.acCRC, aprPrioCRC->acCRC);\n" \
10276  " /* Traitement des erreurs SQL */\n" \
10277  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureBLCRCLR\");\n" \
10278  " EXEC SQL\n" \
10279  " OPEN crsLectureBLCRCLR\n" \
10280  " USING :rPrioCRC.acEtab,\n" \
10281  " :rPrioCRC.acCodan8,\n" \
10282  " :rPrioCRC.acTpdsob,\n" \
10283  " :rPrioCRC.acCRC;\n" \
10284  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10285  "\n" \
10286  " if ((int4)GIV::GYBok != iIntRet)\n" \
10287  " {\n" \
10288  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureBLCRCLR : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10289  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10290  " }\n" \
10291  "\n" \
10292  " if ((int4)GIV::GYBok == iIntRet)\n" \
10293  " {\n" \
10294  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
10295  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureBLCRCLR\");\n" \
10296  " GWTTrace(GWT_NIV_FONCT, (\" BLCRCLR... %s,%s,%s,%s\\n\", rPrioCRC.acCodan8, rPrioCRC.acEtab, rPrioCRC.acTpdsob, rPrioCRC.acCRC));\n" \
10297  "\n" \
10298  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
10299  " {\n" \
10300  " EXEC SQL\n" \
10301  " FETCH crsLectureBLCRCLR\n" \
10302  " INTO: rPrioCRC.acCodan8;\n" \
10303  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10304  "\n" \
10305  " if ((int4)GIV::GYBok != iIntRet)\n" \
10306  " {\n" \
10307  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10308  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10309  " }\n" \
10310  " else\n" \
10311  " {\n" \
10312  " /* sortie sur opposition trouvée */\n" \
10313  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10314  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
10315  " }\n" \
10316  " }\n" \
10317  " }\n" \
10318  "\n" \
10319  " EXEC SQL\n" \
10320  " close crsLectureBLCRCLR;\n" \
10321  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10322  "\n" \
10323  " if ((int4)GIV::GYBok != iIntRet)\n" \
10324  " {\n" \
10325  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureBLCRCLR: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10326  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10327  " }\n" \
10328  "\n" \
10329  " return (iCodRet);\n" \
10330  "}\n" \
10331  "\n" \
10332  "/*----------------------------------Fonction----------------------------------*\n" \
10333  " * Fonction : givLectureBListCRCFD\n" \
10334  " *\n" \
10335  " * But : numcli\n" \
10336  " *\n" \
10337  " * Description : Lecture du black-listage en fiche détaillée\n" \
10338  " * dans la table GYTTabBListCRCLR.\n" \
10339  " *\n" \
10340  " *\n" \
10341  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
10342  "\n" \
10343  "int4 givLectureBListCRCFD(GYBrPrioCRCT* aprPrioCRC)\n" \
10344  "{\n" \
10345  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
10346  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
10347  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
10348  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
10349  " EXEC SQL\n" \
10350  " begin declare\n" \
10351  " section;\n" \
10352  " GYBrPrioCRCT rPrioCRC;\n" \
10353  " EXEC SQL\n" \
10354  " end declare\n" \
10355  " section;\n" \
10356  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10357  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
10358  "\n" \
10359  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
10360  " return (iCodRet);\n" \
10361  "\n" \
10362  " /* variables Oracle */\n" \
10363  " (void)strcpy(rPrioCRC.acEtab, aprPrioCRC->acEtab);\n" \
10364  " (void)strcpy(rPrioCRC.acCRC, aprPrioCRC->acCRC);\n" \
10365  " (void)strcpy(rPrioCRC.acTpdsob, aprPrioCRC->acTpdsob);\n" \
10366  " /* Traitement des erreurs SQL */\n" \
10367  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureBLCRCFD\");\n" \
10368  " EXEC SQL\n" \
10369  " OPEN crsLectureBLCRCFD\n" \
10370  " USING :rPrioCRC.acEtab,\n" \
10371  " :rPrioCRC.acCRC,\n" \
10372  " :rPrioCRC.acTpdsob;\n" \
10373  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10374  "\n" \
10375  " if ((int4)GIV::GYBok != iIntRet)\n" \
10376  " {\n" \
10377  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureBLCRCFD : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10378  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10379  " }\n" \
10380  "\n" \
10381  " if ((int4)GIV::GYBok == iIntRet)\n" \
10382  " {\n" \
10383  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
10384  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureBLCRCFD\");\n" \
10385  " GWTTrace(GWT_NIV_FONCT, (\" BLCRCFD... %s,%s,%s,%s\\n\", rPrioCRC.acCodan8, rPrioCRC.acEtab, rPrioCRC.acTpdsob, rPrioCRC.acCRC));\n" \
10386  "\n" \
10387  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
10388  " {\n" \
10389  " EXEC SQL\n" \
10390  " FETCH crsLectureBLCRCFD\n" \
10391  " INTO: rPrioCRC.acTpdsob;\n" \
10392  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10393  "\n" \
10394  " if ((int4)GIV::GYBok != iIntRet)\n" \
10395  " {\n" \
10396  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10397  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10398  " }\n" \
10399  " else\n" \
10400  " {\n" \
10401  " /* sortie sur opposition trouvée */\n" \
10402  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10403  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
10404  " }\n" \
10405  " }\n" \
10406  " }\n" \
10407  "\n" \
10408  " EXEC SQL\n" \
10409  " close crsLectureBLCRCFD;\n" \
10410  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10411  "\n" \
10412  " if ((int4)GIV::GYBok != iIntRet)\n" \
10413  " {\n" \
10414  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureBLCRCFD: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10415  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10416  " }\n" \
10417  "\n" \
10418  " return (iCodRet);\n" \
10419  "}\n" \
10420  "\n" \
10421  "/*----------------------------------Fonction----------------------------------*\n" \
10422  " * Fonction : givLectureBListEPJFD\n" \
10423  " *\n" \
10424  " * But : numcli\n" \
10425  " *\n" \
10426  " * Description : Lecture du black-listage en fiche détaillée\n" \
10427  " * dans la table GYTTabBListEPJFD.\n" \
10428  " *\n" \
10429  " *\n" \
10430  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
10431  "\n" \
10432  "int4 givLectureBListEPJFD(char* acEtab)\n" \
10433  "{\n" \
10434  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
10435  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
10436  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
10437  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
10438  " EXEC SQL\n" \
10439  " begin declare\n" \
10440  " section;\n" \
10441  " GYBrPrioCRCT rPrioCRC;\n" \
10442  " EXEC SQL\n" \
10443  " end declare\n" \
10444  " section;\n" \
10445  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10446  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
10447  "\n" \
10448  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
10449  " return (iCodRet);\n" \
10450  "\n" \
10451  " /* variables Oracle */\n" \
10452  " (void)strcpy(rPrioCRC.acEtab, acEtab);\n" \
10453  " /* Traitement des erreurs SQL */\n" \
10454  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureBLEPJFD\");\n" \
10455  " EXEC SQL\n" \
10456  " OPEN crsLectureBLEPJFD\n" \
10457  " USING: rPrioCRC.acEtab;\n" \
10458  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10459  "\n" \
10460  " if ((int4)GIV::GYBok != iIntRet)\n" \
10461  " {\n" \
10462  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureBLEPJFD : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10463  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10464  " }\n" \
10465  "\n" \
10466  " if ((int4)GIV::GYBok == iIntRet)\n" \
10467  " {\n" \
10468  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
10469  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureBLEPJFD\");\n" \
10470  "\n" \
10471  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
10472  " {\n" \
10473  " EXEC SQL\n" \
10474  " FETCH crsLectureBLEPJFD\n" \
10475  " INTO: rPrioCRC.acEtab;\n" \
10476  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10477  "\n" \
10478  " if ((int4)GIV::GYBok != iIntRet)\n" \
10479  " {\n" \
10480  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10481  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10482  " }\n" \
10483  " else\n" \
10484  " {\n" \
10485  " /* sortie sur opposition trouvée */\n" \
10486  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10487  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
10488  " }\n" \
10489  " }\n" \
10490  "\n" \
10491  " GWTTrace(GWT_NIV_FONCT, (\" BLEPJFD... %s,%d\\n\", rPrioCRC.acEtab, iCodRet));\n" \
10492  " }\n" \
10493  "\n" \
10494  " EXEC SQL\n" \
10495  " close crsLectureBLEPJFD;\n" \
10496  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10497  "\n" \
10498  " if ((int4)GIV::GYBok != iIntRet)\n" \
10499  " {\n" \
10500  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureBLEPJFD: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10501  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10502  " }\n" \
10503  "\n" \
10504  " return (iCodRet);\n" \
10505  "}\n" \
10506  "\n" \
10507  "/*----------------------------------Fonction----------------------------------*\n" \
10508  " * Fonction : givLectureBListEPJProf\n" \
10509  " *\n" \
10510  " * But : numcli\n" \
10511  " *\n" \
10512  " * Description : Lecture du black-listage\n" \
10513  " * dans la table GYTTabBListEPJProf.\n" \
10514  " *\n" \
10515  " *\n" \
10516  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
10517  "\n" \
10518  "int4 givLectureBListEPJProf(char* apcEtab, char* apcCodAn8)\n" \
10519  "{\n" \
10520  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
10521  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
10522  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
10523  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
10524  " EXEC SQL\n" \
10525  " begin declare\n" \
10526  " section;\n" \
10527  " GYBrIeinscT rInscrip;\n" \
10528  " GYBrIaprofT rIaprof;\n" \
10529  " EXEC SQL\n" \
10530  " end declare\n" \
10531  " section;\n" \
10532  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10533  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
10534  "\n" \
10535  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
10536  " return (iCodRet);\n" \
10537  "\n" \
10538  " /* variables Oracle */\n" \
10539  " (void)strcpy(rInscrip.acEtab, apcEtab);\n" \
10540  " (void)strcpy(rIaprof.acCodan8, apcCodAn8);\n" \
10541  " /* Traitement des erreurs SQL */\n" \
10542  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureBLEPJProf\");\n" \
10543  " EXEC SQL\n" \
10544  " OPEN crsLectureBLEPJProf\n" \
10545  " USING :rInscrip.acEtab,\n" \
10546  " :rIaprof.acCodan8;\n" \
10547  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10548  "\n" \
10549  " if ((int4)GIV::GYBok != iIntRet)\n" \
10550  " {\n" \
10551  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureBLEPJProf : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10552  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10553  " }\n" \
10554  "\n" \
10555  " if ((int4)GIV::GYBok == iIntRet)\n" \
10556  " {\n" \
10557  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
10558  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureBLEPJProf\");\n" \
10559  " GWTTrace(GWT_NIV_FONCT, (\" BLEPJProf... %s,%s\\n\", rIaprof.acCodan8, rInscrip.acEtab));\n" \
10560  "\n" \
10561  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
10562  " {\n" \
10563  " EXEC SQL\n" \
10564  " FETCH crsLectureBLEPJProf\n" \
10565  " INTO: rIaprof.acCodan8;\n" \
10566  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10567  "\n" \
10568  " if ((int4)GIV::GYBok != iIntRet)\n" \
10569  " {\n" \
10570  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10571  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10572  " }\n" \
10573  " else\n" \
10574  " {\n" \
10575  " /* sortie sur opposition trouvée */\n" \
10576  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10577  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
10578  " }\n" \
10579  " }\n" \
10580  " }\n" \
10581  "\n" \
10582  " EXEC SQL\n" \
10583  " close crsLectureBLEPJProf;\n" \
10584  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10585  "\n" \
10586  " if ((int4)GIV::GYBok != iIntRet)\n" \
10587  " {\n" \
10588  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureBLEPJProf: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10589  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10590  " }\n" \
10591  "\n" \
10592  " return (iCodRet);\n" \
10593  "}\n" \
10594  "\n" \
10595  "/*----------------------------------Fonction----------------------------------*\n" \
10596  " * Fonction : givLectureBUC\n" \
10597  " *\n" \
10598  " * But : numcli\n" \
10599  " *\n" \
10600  " * Description : Lecture de numcli via etab\n" \
10601  " * dans la table GYTtabIEINSC.\n" \
10602  " *\n" \
10603  " *\n" \
10604  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
10605  "\n" \
10606  "int4 givLectureBUC(char* apcEtab, char* acMin, char* acMax)\n" \
10607  "{\n" \
10608  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
10609  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
10610  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
10611  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
10612  " EXEC SQL\n" \
10613  " begin declare\n" \
10614  " section;\n" \
10615  " char tcEtab[GYBIeinscLgEtab2]; /* etab */\n" \
10616  " char tcNumcli[GYBIeinscLgNumcli2]; /* client */\n" \
10617  " char OraMin[5], OraMax[5];\n" \
10618  " int2 sIndic;\n" \
10619  " EXEC SQL\n" \
10620  " VAR tcNumcli\n" \
10621  " IS STRING;\n" \
10622  " EXEC SQL\n" \
10623  " end declare\n" \
10624  " section;\n" \
10625  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
10626  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
10627  " (void)strcpy(tcEtab, apcEtab);\n" \
10628  " (void)strcpy(OraMin, acMin);\n" \
10629  " (void)strcpy(OraMax, acMax);\n" \
10630  " /* Traitement des erreurs SQL */\n" \
10631  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureBUC\");\n" \
10632  " EXEC SQL\n" \
10633  " OPEN crsLectureBUC\n" \
10634  " USING :tcEtab,:OraMin,:OraMax;\n" \
10635  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10636  "\n" \
10637  " if ((int4)GIV::GYBok != iIntRet)\n" \
10638  " {\n" \
10639  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureBUC: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10640  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10641  " }\n" \
10642  "\n" \
10643  " GWTTrace(GWT_NIV_FONCT, (\"BUC: %s\\n\", apcEtab));\n" \
10644  "\n" \
10645  " if ((int4)GIV::GYBok == iIntRet)\n" \
10646  " {\n" \
10647  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
10648  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureBUC\");\n" \
10649  "\n" \
10650  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
10651  " {\n" \
10652  " EXEC SQL\n" \
10653  " FETCH crsLectureBUC\n" \
10654  " INTO: tcNumcli: sIndic;\n" \
10655  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10656  "\n" \
10657  " if (((int4)GIV::GYBok != iIntRet) || ((int4)GIV::GYBok != sIndic))\n" \
10658  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
10659  " else\n" \
10660  " {\n" \
10661  " if (0 == strlen(buf_concat))\n" \
10662  " strcpy(buf_concat, &tcNumcli[4]);\n" \
10663  " else\n" \
10664  " {\n" \
10665  " strcat(buf_concat, \"|\");\n" \
10666  " strcat(buf_concat, &tcNumcli[4]);\n" \
10667  " }\n" \
10668  "\n" \
10669  " GWTTrace(GWT_NIV_FONCT, (\" BUC... %s\\n\", buf_concat));\n" \
10670  " }\n" \
10671  " }\n" \
10672  " }\n" \
10673  "\n" \
10674  " EXEC SQL\n" \
10675  " close crsLectureBUC;\n" \
10676  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10677  "\n" \
10678  " if ((int4)GIV::GYBok != iIntRet)\n" \
10679  " {\n" \
10680  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureBUC: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10681  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10682  " }\n" \
10683  "\n" \
10684  " return (iCodRet);\n" \
10685  "}\n" \
10686  "\n" \
10687  "/*----------------------------------Fonction----------------------------------*\n" \
10688  " * Fonction : givLectureEvIlo\n" \
10689  " *\n" \
10690  " * But : ref back office ILO\n" \
10691  " *\n" \
10692  " * Description : Lecture de ref\n" \
10693  " * dans la table GYTtabEVILO.\n" \
10694  " *\n" \
10695  " *\n" \
10696  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
10697  "\n" \
10698  "int4 givLectureEvIlo(char* apcEtab, char* acEvt, char* acPrg)\n" \
10699  "{\n" \
10700  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
10701  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
10702  " int1 indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
10703  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
10704  " EXEC SQL\n" \
10705  " begin declare\n" \
10706  " section;\n" \
10707  " char* pcOraEtab;\n" \
10708  " char cOraEvt = '\\0', cOraPrg = '\\0';\n" \
10709  " int2 sIndEvt, sIndPrg;\n" \
10710  " EXEC SQL\n" \
10711  " end declare\n" \
10712  " section;\n" \
10713  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
10714  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
10715  " pcOraEtab = apcEtab;\n" \
10716  " /* Traitement des erreurs SQL */\n" \
10717  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureEvIlo\");\n" \
10718  " EXEC SQL\n" \
10719  " OPEN crsLectureEvIlo\n" \
10720  " USING: pcOraEtab;\n" \
10721  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10722  "\n" \
10723  " if ((int4)GIV::GYBok != iIntRet)\n" \
10724  " {\n" \
10725  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureEvIlo: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10726  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10727  " }\n" \
10728  "\n" \
10729  " *acEvt = '\\0';\n" \
10730  " *acPrg = '\\0';\n" \
10731  "\n" \
10732  " if ((int4)GIV::GYBok == iIntRet)\n" \
10733  " {\n" \
10734  " EXEC SQL\n" \
10735  " FETCH crsLectureEvIlo\n" \
10736  " INTO\n" \
10737  " :cOraEvt:sIndEvt,:cOraPrg:sIndPrg;\n" \
10738  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10739  "\n" \
10740  " if ((int4)GIV::GYBok == sIndEvt)\n" \
10741  " *acEvt = cOraEvt;\n" \
10742  "\n" \
10743  " if ((int4)GIV::GYBok == sIndPrg)\n" \
10744  " *acPrg = cOraPrg;\n" \
10745  " }\n" \
10746  "\n" \
10747  " EXEC SQL\n" \
10748  " close crsLectureEvIlo;\n" \
10749  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10750  "\n" \
10751  " if ((int4)GIV::GYBok != iIntRet)\n" \
10752  " {\n" \
10753  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureEvIlo: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10754  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10755  " }\n" \
10756  "\n" \
10757  " GWTTrace(GWT_NIV_FONCT, (\"EvIlo: %s, %c, %c\\n\", apcEtab, *acEvt, *acPrg));\n" \
10758  " return (iCodRet);\n" \
10759  "}\n" \
10760  "\n" \
10761  "/*----------------------------------Fonction----------------------------------*\n" \
10762  " * Fonction : givLectureSIRET\n" \
10763  " *\n" \
10764  " * But : SIRET de Pages.\n" \
10765  " *\n" \
10766  " * Description : Lecture du siret\n" \
10767  " * dans la table GYTtabPagesPro.\n" \
10768  " *\n" \
10769  " *\n" \
10770  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
10771  "\n" \
10772  "int4 givLectureSIRET(char* apcSiret)\n" \
10773  "{\n" \
10774  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
10775  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
10776  " int1 indFinFetch = 0;/* Indicateur de fin de balayage du curseur */\n" \
10777  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
10778  " int4 iIdx;\n" \
10779  " int4 j;\n" \
10780  " EXEC SQL\n" \
10781  " begin declare\n" \
10782  " section;\n" \
10783  " char tcSiret[GYBIeinscLgSiret2]; /* siret */\n" \
10784  " EXEC SQL\n" \
10785  " end declare\n" \
10786  " section;\n" \
10787  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
10788  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
10789  " (void)strcpy(tcSiret, apcSiret);\n" \
10790  " /* Traitement des erreurs SQL */\n" \
10791  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureSIRET\");\n" \
10792  " EXEC SQL\n" \
10793  " OPEN crsLectureSIRET\n" \
10794  " USING: tcSiret;\n" \
10795  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10796  "\n" \
10797  " if ((int4)GIV::GYBok != iIntRet)\n" \
10798  " {\n" \
10799  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureSIRET: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10800  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10801  " }\n" \
10802  "\n" \
10803  " if ((int4)GIV::GYBok == iIntRet)\n" \
10804  " {\n" \
10805  " EXEC SQL\n" \
10806  " FETCH crsLectureSIRET\n" \
10807  " INTO: tcSiret;\n" \
10808  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10809  "\n" \
10810  " if ((int4)GIV::GYBok != iIntRet)\n" \
10811  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10812  " }\n" \
10813  "\n" \
10814  " EXEC SQL\n" \
10815  " close crsLectureSIRET;\n" \
10816  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
10817  "\n" \
10818  " if ((int4)GIV::GYBok != iIntRet)\n" \
10819  " {\n" \
10820  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureSIRET: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
10821  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10822  " }\n" \
10823  "\n" \
10824  " return (iCodRet);\n" \
10825  "}\n" \
10826  "\n" \
10827  "/*----------------------------------Fonction----------------------------------*\n" \
10828  " * Fonction : GIVLectureTabPeEtab ()\n" \
10829  " *\n" \
10830  " * But : Lecture d'un tuple dans la table PEETAB\n" \
10831  " *\n" \
10832  " * Description :\n" \
10833  " *\n" \
10834  " * Portabilité : sûrement portable\n" \
10835  " *\n" \
10836  " * Interface :\n" \
10837  " *\n" \
10838  " * Paramètres :\n" \
10839  " *\n" \
10840  " * Valeurs retournées : -1 : erreur dans le traitement\n" \
10841  " * 0 : acces a la table correct\n" \
10842  " *\n" \
10843  " * Erreurs : erreur SQL sur execution de la requete SELECT\n" \
10844  " *\n" \
10845  " *---------------------------------Historique----------------------------------\n" \
10846  " *\n" \
10847  " * Création : Jun/03/1996 (jli)\n" \
10848  " *\n" \
10849  " * Modification (Mar/08/2006 - mb) : Rappel Gratuit\n" \
10850  " *\n" \
10851  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
10852  "\n" \
10853  "int4 GIVLectureTabPeEtab(char* pcEtab)\n" \
10854  "{\n" \
10855  " /* définition et initialisation des données locales */\n" \
10856  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
10857  " int4 iIntRet = 0; /* Code retour interne */\n" \
10858  " int1 indFinFetch; /* Indicateur de fin de balayage du curseur */\n" \
10859  " GYBrParam_erreurT rErreurSQL; /* Traitement des erreurs SQL */\n" \
10860  " int4 iQualite;\n" \
10861  " /* données d'interface sgbd */\n" \
10862  " EXEC SQL\n" \
10863  " begin declare\n" \
10864  " section;\n" \
10865  " GYBrIeinscT* pvInscrip;\n" \
10866  " GYBrIndIeinscT* pvIndInscrip;\n" \
10867  " GYBrPeadrT* pvAdr;\n" \
10868  " GYBrIndPeadrT* pvIndAdr;\n" \
10869  " EXEC SQL\n" \
10870  " end declare\n" \
10871  " section;\n" \
10872  " /* Initialisation des variables locales */\n" \
10873  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
10874  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
10875  " /* la lecture se fait dans les vaibles globales */\n" \
10876  " /** limite les passages d'argument des 60 champs et assure la cohérence de fiat */\n" \
10877  " pvInscrip = &GIVvInscrip;\n" \
10878  " pvIndInscrip = &GIVvIndInscrip;\n" \
10879  " pvAdr = &GIVvAdr;\n" \
10880  " pvIndAdr = &GIVvIndAdr;\n" \
10881  " /* initialisation des éléments de lcé de lecture de la table etab */\n" \
10882  " strcpy(pvInscrip->acEtab, pcEtab);\n" \
10883  " /* Ouverture curseur SQL (car requete type SELECT) */\n" \
10884  " (void)strcpy(rErreurSQL.acOrdre_sql, \"open crsLecturePeETAB\");\n" \
10885  " EXEC SQL\n" \
10886  " open crsLecturePeEtab\n" \
10887  " using :pvInscrip->acEtab;\n" \
10888  " iIntRet = GIVBlocErreur(&rErreurSQL);\n" \
10889  "\n" \
10890  " if ((int4)GIV::GYBok != iIntRet)\n" \
10891  " {\n" \
10892  " /* Erreur sur declaration curseur SQL */\n" \
10893  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur OPEN crsLecturePeEtab ...\\n\"));\n" \
10894  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10895  " }\n" \
10896  " else\n" \
10897  " {\n" \
10898  " /* Execution requete de recherche (FETCH du curseur) */\n" \
10899  " (void)strcpy(rErreurSQL.acOrdre_sql, \"fetch crsLecturePeEtab\");\n" \
10900  " pvIndInscrip->sArrondI = (int4)GIV::GYBnok;\n" \
10901  " EXEC SQL\n" \
10902  " fetch crsLecturePeEtab\n" \
10903  " into\n" \
10904  " :pvInscrip->acEtab\n" \
10905  " :pvIndInscrip->sEtabI,\n" \
10906  " :pvInscrip->acSiret:pvIndInscrip->sSiretI,\n" \
10907  " :pvInscrip->acNaf:pvIndInscrip->sNafI,\n" \
10908  " :pvInscrip->acDenom:pvIndInscrip->sDenomI,\n" \
10909  " :pvInscrip->acCompln:pvIndInscrip->sComplnI,\n" \
10910  " :pvInscrip->acCoddep:pvIndInscrip->sCoddepI,\n" \
10911  " :pvInscrip->acCodloc:pvIndInscrip->sCodlocI,\n" \
10912  " :pvInscrip->acAdrnr:pvIndInscrip->sAdrnrI,\n" \
10913  " :pvInscrip->acCodvoi:pvIndInscrip->sCodvoiI,\n" \
10914  " :pvInscrip->acTypvoi:pvIndInscrip->sTypvoiI,\n" \
10915  " :pvInscrip->acLibvoi:pvIndInscrip->sLibvoiI,\n" \
10916  " :pvInscrip->acNovoie:pvIndInscrip->sNovoieI,\n" \
10917  " :pvInscrip->acCplnov:pvIndInscrip->sCplnovI,\n" \
10918  " :pvAdr->acLongitude:pvIndAdr->sLongitudeI,\n" \
10919  " :pvAdr->acLatitude:pvIndAdr->sLatitudeI,\n" \
10920  " :pvAdr->acPrec:pvIndAdr->sPrecI;\n" \
10921  " iIntRet = GIVBlocErreur(&rErreurSQL);\n" \
10922  "\n" \
10923  " if ((int4)GIV::GYBok != iIntRet)\n" \
10924  " {\n" \
10925  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur execute LecturePeETAB : [COD=%d TXT=%s]\\n\", iIntRet, rErreurSQL.acDonnees_retour));\n" \
10926  "\n" \
10927  " if ((int4)GIV::GYBnodata == iIntRet)\n" \
10928  " GWTTrace(GWT_NIV_BIZAR, (\"pas de donnée dans PeEtab : [COD=%d TXT=%s]\\n\", iIntRet, rErreurSQL.acDonnees_retour));\n" \
10929  "\n" \
10930  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10931  " }\n" \
10932  "\n" \
10933  " /* Fermeture du curseur */\n" \
10934  " (void)strcpy(rErreurSQL.acOrdre_sql, \"close crsLecturePeEtab\");\n" \
10935  " EXEC SQL\n" \
10936  " close crsLecturePeEtab;\n" \
10937  " iIntRet = GIVBlocErreur(&rErreurSQL);\n" \
10938  "\n" \
10939  " if ((int4)GIV::GYBok != iIntRet)\n" \
10940  " {\n" \
10941  " /* Erreur sur fermeture curseur SQL */\n" \
10942  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur CLOSE crsLecturePeEtab ...\\n\"));\n" \
10943  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
10944  " }\n" \
10945  " }\n" \
10946  "\n" \
10947  " /* support et parution par défaut */\n" \
10948  " GIVvIndInscrip.sInsuppI = 0;\n" \
10949  " GIVvInscrip.acInsupp[0] = 1;\n" \
10950  " GIVvIndInscrip.sInparuI = 0;\n" \
10951  " strcpy(GIVvInscrip.acInparu, \"0000\");\n" \
10952  "\n" \
10953  " /* Tester la validité du géocodage */\n" \
10954  " if (-1 == GIVvIndAdr.sPrecI)\n" \
10955  " {\n" \
10956  " iQualite = 99;\n" \
10957  " snprintf(GIVvGeocod.tcQualite, GIVGeocodLgQualite + 1, \"%2d\", 99);\n" \
10958  " }\n" \
10959  " else\n" \
10960  " {\n" \
10961  " iQualite = atoi(GIVvAdr.acPrec);\n" \
10962  " snprintf(GIVvGeocod.tcQualite, GIVGeocodLgQualite + 1, \"%2s\", GIVvAdr.acPrec);\n" \
10963  " }\n" \
10964  "\n" \
10965  " switch (iQualite)\n" \
10966  " {\n" \
10967  " case 96:\n" \
10968  " GIVvGeocod.iStatus = GIVGeocodSEnvXY;\n" \
10969  " break;\n" \
10970  "\n" \
10971  " case 97:\n" \
10972  " GIVvGeocod.iStatus = GIVGeocodSEnvIndic;\n" \
10973  " break;\n" \
10974  "\n" \
10975  " case 98:\n" \
10976  " GIVvGeocod.iStatus = GIVGeocodSEnvXY;\n" \
10977  " break;\n" \
10978  "\n" \
10979  " case 99:\n" \
10980  " GIVvGeocod.iStatus = GIVGeocodSEnvRien;\n" \
10981  " break;\n" \
10982  "\n" \
10983  " default:\n" \
10984  " GIVvGeocod.iStatus = GIVGeocodSEnvXYQ;\n" \
10985  " break;\n" \
10986  " }\n" \
10987  "\n" \
10988  " if (-1 == GIVvIndAdr.sLongitudeI)\n" \
10989  " GIVvGeocod.tcLongitude[0] = '\\0';\n" \
10990  " else\n" \
10991  " snprintf(GIVvGeocod.tcLongitude, GIVGeocodLgLongitude + 1, \"%s\", GIVvAdr.acLongitude);\n" \
10992  "\n" \
10993  " if (-1 == GIVvIndAdr.sLatitudeI)\n" \
10994  " GIVvGeocod.tcLatitude[0] = '\\0';\n" \
10995  " else\n" \
10996  " snprintf(GIVvGeocod.tcLatitude, GIVGeocodLgLatitude + 1, \"%s\", GIVvAdr.acLatitude);\n" \
10997  "\n" \
10998  " /* Sortie de la fonction */\n" \
10999  " return (iCodRet);\n" \
11000  "}\n" \
11001  "\n" \
11002  "/*----------------------------------Fonction----------------------------------*\n" \
11003  " * Fonction : givLectureTabZU ()\n" \
11004  " *\n" \
11005  " * But : Recherche de la zone urbaine\n" \
11006  " *\n" \
11007  " * Description :\n" \
11008  " *\n" \
11009  " *\n" \
11010  " *\n" \
11011  " *\n" \
11012  " * Portabilité : sûrement portable\n" \
11013  " *\n" \
11014  " * Interface :\n" \
11015  " *\n" \
11016  " * Paramètres :\n" \
11017  " *\n" \
11018  " * Valeurs retournées : -1 : erreur dans le traitement\n" \
11019  " * 0 : pas de tuple trouve\n" \
11020  " *\n" \
11021  " *\n" \
11022  " * Erreurs : erreur SQL sur execution de la requete SELECT\n" \
11023  " *\n" \
11024  " *---------------------------------Historique----------------------------------\n" \
11025  " *\n" \
11026  " * Création : Jan/17/2006 (mb)\n" \
11027  " *\n" \
11028  " * Modification (MM/JJ/AAAA - xx) :\n" \
11029  " *\n" \
11030  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
11031  "\n" \
11032  "int4 givLectureTabZU(char* pcDep, char* pcLoc)\n" \
11033  "\n" \
11034  "{\n" \
11035  " int4 iCodRet; /* Code retour de la fonction */\n" \
11036  " int4 iIntRet; /* Code retour des appels internes */\n" \
11037  " int1 indFinFetch; /* Indicateur de fin de balayage du curseur */\n" \
11038  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
11039  " EXEC SQL\n" \
11040  " begin declare\n" \
11041  " section;\n" \
11042  " GYBrPelzuT* pvPole;\n" \
11043  " GYBrIndPelzuT* pvIndPole;\n" \
11044  " EXEC SQL\n" \
11045  " end declare\n" \
11046  " section;\n" \
11047  " GWTTrace(GWT_NIV_FONCT, (\"givLectureZU\\n\"));\n" \
11048  "\n" \
11049  " if (0 == strcmp(givcLocFictive, pcLoc))\n" \
11050  " {\n" \
11051  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11052  " /* appael inutile pour LF */\n" \
11053  " return (iCodRet);\n" \
11054  " }\n" \
11055  "\n" \
11056  " iIntRet = givPreparerLectureZU();\n" \
11057  "\n" \
11058  " if ((int4)GIV::GYBok != iIntRet)\n" \
11059  " {\n" \
11060  " /* Erreur sur prepare curseur SQL */\n" \
11061  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur crsLectureZU ...\\n\"));\n" \
11062  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11063  " }\n" \
11064  " else\n" \
11065  " {\n" \
11066  " /* Initialisation des variables locales */\n" \
11067  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
11068  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
11069  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
11070  " /* Valorisation du pointeur vers la structure de description de la table PAYS */\n" \
11071  " pvPole = &GIVvPole;\n" \
11072  " pvIndPole = &GIVvIndPole;\n" \
11073  " /* Valorisation du pointeur vers la structure de description */\n" \
11074  " /* du tableau de recuperation des correspondances AN8/AN9 */\n" \
11075  " (void)strcpy((char*)pvPole->acDepart, (const char*)pcDep);\n" \
11076  " (void)strcpy((char*)pvPole->acNumloc, (const char*)pcLoc);\n" \
11077  " /* Ouverture curseur SQL (car requete type SELECT) */\n" \
11078  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureZU\");\n" \
11079  " EXEC SQL\n" \
11080  " open crsLectureZU\n" \
11081  " using :pvPole->acDepart,\n" \
11082  " :pvPole->acNumloc;\n" \
11083  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
11084  "\n" \
11085  " if ((int4)GIV::GYBok != iIntRet)\n" \
11086  " {\n" \
11087  " /* Erreur sur declaration curseur SQL */\n" \
11088  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur OPEN crsLectureZU ...\\n\"));\n" \
11089  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11090  " }\n" \
11091  " else\n" \
11092  " {\n" \
11093  " /* Execution requete de denombrement (FETCH du curseur) */\n" \
11094  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
11095  "\n" \
11096  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
11097  " {\n" \
11098  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureZU\");\n" \
11099  " EXEC SQL\n" \
11100  " fetch crsLectureZU\n" \
11101  " into\n" \
11102  " :pvPole->acDepPole\n" \
11103  " :pvIndPole->sDepPoleI,\n" \
11104  " :pvPole->acLocPole:pvIndPole->sLocPoleI\n" \
11105  " ;\n" \
11106  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
11107  "\n" \
11108  " /* Analyse du code retour SQL */\n" \
11109  " switch (iIntRet)\n" \
11110  " {\n" \
11111  " case (int4)GIV::GYBok:\n" \
11112  " {\n" \
11113  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
11114  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
11115  " break;\n" \
11116  " }\n" \
11117  "\n" \
11118  " case (int4)GIV::GYBnodata:\n" \
11119  " {\n" \
11120  " /* la localite n'existe pas */\n" \
11121  " /* generer une signalisation */\n" \
11122  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
11123  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11124  " break;\n" \
11125  " }\n" \
11126  "\n" \
11127  " default:\n" \
11128  " {\n" \
11129  " /* la consultation de la base s'est mal passee */\n" \
11130  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur execute rqtLectureZU : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
11131  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
11132  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11133  " break;\n" \
11134  " }\n" \
11135  " }\n" \
11136  " }\n" \
11137  "\n" \
11138  " /* Fermeture du curseur */\n" \
11139  " (void)strcpy(vErreurSQL.acOrdre_sql, \"close crsLectureZU\");\n" \
11140  " EXEC SQL\n" \
11141  " close crsLectureZU;\n" \
11142  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
11143  "\n" \
11144  " if ((int4)GIV::GYBok != iIntRet)\n" \
11145  " {\n" \
11146  " /* Erreur sur fermeture curseur SQL */\n" \
11147  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur CLOSE crsLectureZU ...\\n\"));\n" \
11148  " }\n" \
11149  " }\n" \
11150  " }\n" \
11151  "\n" \
11152  " /* Sortie de la fonction */\n" \
11153  " GWTTrace(GWT_NIV_FONCT, (\"GIVLectureZU\\n\"));\n" \
11154  " return (iCodRet);\n" \
11155  "}\n" \
11156  "\n" \
11157  "/*----------------------------------Fonction----------------------------------*\n" \
11158  " * Fonction : givLectureTabLocFus ()\n" \
11159  " *\n" \
11160  " * But : Recherche de la localité fusionnée\n" \
11161  " *\n" \
11162  " * Description :\n" \
11163  " *\n" \
11164  " *\n" \
11165  " *\n" \
11166  " *\n" \
11167  " * Portabilité : sûrement portable\n" \
11168  " *\n" \
11169  " * Interface :\n" \
11170  " *\n" \
11171  " * Paramètres :\n" \
11172  " *\n" \
11173  " * Valeurs retournées : -1 : erreur dans le traitement\n" \
11174  " * 0 : pas de tuple trouve\n" \
11175  " *\n" \
11176  " *\n" \
11177  " * Erreurs : erreur SQL sur execution de la requete SELECT\n" \
11178  " *\n" \
11179  " *---------------------------------Historique----------------------------------\n" \
11180  " *\n" \
11181  " * Création : Nov/17/2016 (mb)\n" \
11182  " *\n" \
11183  " * Modification (MM/JJ/AAAA - xx) :\n" \
11184  " *\n" \
11185  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
11186  "\n" \
11187  "int4 givLectureTabLocFus(char* pcDep, char* pcLoc)\n" \
11188  "\n" \
11189  "{\n" \
11190  " int4 iCodRet; /* Code retour de la fonction */\n" \
11191  " int4 iIntRet; /* Code retour des appels internes */\n" \
11192  " int1 indFinFetch; /* Indicateur de fin de balayage du curseur */\n" \
11193  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
11194  " EXEC SQL\n" \
11195  " begin declare\n" \
11196  " section;\n" \
11197  " GYBrPelzuT* pvPole;\n" \
11198  " GYBrIndPelzuT* pvIndPole;\n" \
11199  " EXEC SQL\n" \
11200  " end declare\n" \
11201  " section;\n" \
11202  " GWTTrace(GWT_NIV_FONCT, (\"givLectureLocFus\\n\"));\n" \
11203  "\n" \
11204  " if (0 == strcmp(givcLocFictive, pcLoc))\n" \
11205  " {\n" \
11206  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11207  " /* appael inutile pour LF */\n" \
11208  " return (iCodRet);\n" \
11209  " }\n" \
11210  "\n" \
11211  " iIntRet = givPreparerLectureLocFus();\n" \
11212  "\n" \
11213  " if ((int4)GIV::GYBok != iIntRet)\n" \
11214  " {\n" \
11215  " /* Erreur sur prepare curseur SQL */\n" \
11216  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur crsLectureLocFus ...\\n\"));\n" \
11217  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11218  " }\n" \
11219  " else\n" \
11220  " {\n" \
11221  " /* Initialisation des variables locales */\n" \
11222  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
11223  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
11224  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
11225  " /* Valorisation du pointeur vers la structure de description de la table PAYS */\n" \
11226  " pvPole = &GIVvPole;\n" \
11227  " pvIndPole = &GIVvIndPole;\n" \
11228  " /* Valorisation du pointeur vers la structure de description */\n" \
11229  " /* du tableau de recuperation des correspondances AN8/AN9 */\n" \
11230  " (void)strcpy((char*)pvPole->acDepart, (const char*)pcDep);\n" \
11231  " (void)strcpy((char*)pvPole->acNumloc, (const char*)pcLoc);\n" \
11232  " /* Ouverture curseur SQL (car requete type SELECT) */\n" \
11233  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureLocFus\");\n" \
11234  " EXEC SQL\n" \
11235  " open crsLectureLocFus\n" \
11236  " using :pvPole->acDepart,\n" \
11237  " :pvPole->acNumloc;\n" \
11238  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
11239  "\n" \
11240  " if ((int4)GIV::GYBok != iIntRet)\n" \
11241  " {\n" \
11242  " /* Erreur sur declaration curseur SQL */\n" \
11243  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur OPEN crsLectureLocFus ...\\n\"));\n" \
11244  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11245  " }\n" \
11246  " else\n" \
11247  " {\n" \
11248  " /* Execution requete de denombrement (FETCH du curseur) */\n" \
11249  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
11250  "\n" \
11251  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
11252  " {\n" \
11253  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureLocFus\");\n" \
11254  " EXEC SQL\n" \
11255  " fetch crsLectureLocFus\n" \
11256  " into\n" \
11257  " :pvPole->acDepPole\n" \
11258  " :pvIndPole->sDepPoleI,\n" \
11259  " :pvPole->acLocPole:pvIndPole->sLocPoleI\n" \
11260  " ;\n" \
11261  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
11262  "\n" \
11263  " /* Analyse du code retour SQL */\n" \
11264  " switch (iIntRet)\n" \
11265  " {\n" \
11266  " case (int4)GIV::GYBok:\n" \
11267  " {\n" \
11268  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
11269  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
11270  " break;\n" \
11271  " }\n" \
11272  "\n" \
11273  " case (int4)GIV::GYBnodata:\n" \
11274  " {\n" \
11275  " /* la localite n'existe pas */\n" \
11276  " /* generer une signalisation */\n" \
11277  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
11278  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11279  " break;\n" \
11280  " }\n" \
11281  "\n" \
11282  " default:\n" \
11283  " {\n" \
11284  " /* la consultation de la base s'est mal passee */\n" \
11285  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur execute rqtLectureLocFus : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
11286  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
11287  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11288  " break;\n" \
11289  " }\n" \
11290  " }\n" \
11291  " }\n" \
11292  "\n" \
11293  " /* Fermeture du curseur */\n" \
11294  " (void)strcpy(vErreurSQL.acOrdre_sql, \"close crsLectureLocFus\");\n" \
11295  " EXEC SQL\n" \
11296  " close crsLectureLocFus;\n" \
11297  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
11298  "\n" \
11299  " if ((int4)GIV::GYBok != iIntRet)\n" \
11300  " {\n" \
11301  " /* Erreur sur fermeture curseur SQL */\n" \
11302  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur CLOSE crsLectureLocFus ...\\n\"));\n" \
11303  " }\n" \
11304  " }\n" \
11305  " }\n" \
11306  "\n" \
11307  " /* Sortie de la fonction */\n" \
11308  " return (iCodRet);\n" \
11309  "}\n" \
11310  "\n" \
11311  "/*----------------------------------Fonction----------------------------------*\n" \
11312  " * Fonction : GIVLectureTabRegion ()\n" \
11313  " *\n" \
11314  " * But : Recherche de la région\n" \
11315  " *\n" \
11316  " * Description :\n" \
11317  " *\n" \
11318  " *\n" \
11319  " *\n" \
11320  " *\n" \
11321  " * Portabilité : sûrement portable\n" \
11322  " *\n" \
11323  " * Interface :\n" \
11324  " *\n" \
11325  " * Paramètres :\n" \
11326  " *\n" \
11327  " * Valeurs retournées : -1 : erreur dans le traitement\n" \
11328  " * 0 : pas de tuple trouve\n" \
11329  " *\n" \
11330  " *\n" \
11331  " * Erreurs : erreur SQL sur execution de la requete SELECT\n" \
11332  " *\n" \
11333  " *---------------------------------Historique----------------------------------\n" \
11334  " *\n" \
11335  " * Création : Jan/25/2006 (mb)\n" \
11336  " *\n" \
11337  " * Modification (MM/JJ/AAAA - xx) :\n" \
11338  " *\n" \
11339  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
11340  "\n" \
11341  "int4 givLectureTabRegion(char* pcDep)\n" \
11342  "\n" \
11343  "{\n" \
11344  " int4 iCodRet; /* Code retour de la fonction */\n" \
11345  " int4 iIntRet; /* Code retour des appels internes */\n" \
11346  " int1 indFinFetch; /* Indicateur de fin de balayage du curseur */\n" \
11347  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
11348  " EXEC SQL\n" \
11349  " begin declare\n" \
11350  " section;\n" \
11351  " GYBrLjdeptT* pvRegion;\n" \
11352  " GYBrIndLjdeptT* pvIndRegion;\n" \
11353  " EXEC SQL\n" \
11354  " end declare\n" \
11355  " section;\n" \
11356  " GWTTrace(GWT_NIV_FONCT, (\"givLectureRegion\\n\"));\n" \
11357  " iIntRet = givPreparerLectureRegion();\n" \
11358  "\n" \
11359  " if ((int4)GIV::GYBok != iIntRet)\n" \
11360  " {\n" \
11361  " /* Erreur sur prepare curseur SQL */\n" \
11362  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur crsLectureRegion ...\\n\"));\n" \
11363  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11364  " }\n" \
11365  " else\n" \
11366  " {\n" \
11367  " /* Initialisation des variables locales */\n" \
11368  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
11369  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
11370  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
11371  " /* Valorisation du pointeur vers la structure de description de la table PAYS */\n" \
11372  " pvRegion = &GIVvRegion;\n" \
11373  " pvIndRegion = &GIVvIndRegion;\n" \
11374  " /* Valorisation du pointeur vers la structure de description */\n" \
11375  " /* du tableau de recuperation des correspondances AN8/AN9 */\n" \
11376  " (void)strcpy((char*)pvRegion->acDepart, (const char*)pcDep);\n" \
11377  " /* Ouverture curseur SQL (car requete type SELECT) */\n" \
11378  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureRegion\");\n" \
11379  " EXEC SQL\n" \
11380  " open crsLectureRegion\n" \
11381  " using :pvRegion->acDepart;\n" \
11382  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
11383  "\n" \
11384  " if ((int4)GIV::GYBok != iIntRet)\n" \
11385  " {\n" \
11386  " /* Erreur sur declaration curseur SQL */\n" \
11387  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur OPEN crsLectureRegion ...\\n\"));\n" \
11388  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11389  " }\n" \
11390  " else\n" \
11391  " {\n" \
11392  " /* Execution requete de denombrement (FETCH du curseur) */\n" \
11393  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
11394  "\n" \
11395  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
11396  " {\n" \
11397  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureRegion\");\n" \
11398  "\n" \
11399  " if (0 == strcmp(givtcRegCECI, \"NON\"))\n" \
11400  " {\n" \
11401  " EXEC SQL\n" \
11402  " fetch crsLectureRegion\n" \
11403  " into\n" \
11404  " :pvRegion->acRegion\n" \
11405  " :pvIndRegion->sRegionI;\n" \
11406  " (void)strcpy(pvRegion->acAncReg, pvRegion->acRegion);\n" \
11407  " }\n" \
11408  " else\n" \
11409  " {\n" \
11410  " EXEC SQL\n" \
11411  " fetch crsLectureRegion\n" \
11412  " into\n" \
11413  " :pvRegion->acRegion\n" \
11414  " :pvIndRegion->sRegionI,\n" \
11415  " :pvRegion->acAncReg\n" \
11416  " ;\n" \
11417  " }\n" \
11418  "\n" \
11419  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
11420  "\n" \
11421  " /* Analyse du code retour SQL */\n" \
11422  " switch (iIntRet)\n" \
11423  " {\n" \
11424  " case (int4)GIV::GYBok:\n" \
11425  " {\n" \
11426  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
11427  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
11428  " break;\n" \
11429  " }\n" \
11430  "\n" \
11431  " case (int4)GIV::GYBnodata:\n" \
11432  " {\n" \
11433  " /* la localite n'existe pas */\n" \
11434  " /* generer une signalisation */\n" \
11435  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
11436  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11437  " break;\n" \
11438  " }\n" \
11439  "\n" \
11440  " default:\n" \
11441  " {\n" \
11442  " /* la consultation de la base s'est mal passee */\n" \
11443  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur execute rqtLectureRegion : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
11444  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
11445  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
11446  " break;\n" \
11447  " }\n" \
11448  " }\n" \
11449  " }\n" \
11450  "\n" \
11451  " /* Fermeture du curseur */\n" \
11452  " (void)strcpy(vErreurSQL.acOrdre_sql, \"close crsLectureRegion\");\n" \
11453  " EXEC SQL\n" \
11454  " close crsLectureRegion;\n" \
11455  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
11456  "\n" \
11457  " if ((int4)GIV::GYBok != iIntRet)\n" \
11458  " {\n" \
11459  " /* Erreur sur fermeture curseur SQL */\n" \
11460  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur CLOSE crsLectureRegion ...\\n\"));\n" \
11461  " }\n" \
11462  " }\n" \
11463  " }\n" \
11464  "\n" \
11465  " /* Sortie de la fonction */\n" \
11466  " GWTTrace(GWT_NIV_FONCT, (\"GIVLectureRegion\\n\"));\n" \
11467  " return (iCodRet);\n" \
11468  "}\n" \
11469  "\n" \
11470  "/*----Fonction----------------------------------------------------------------*/\n" \
11471  "/* */\n" \
11472  "/* Fonction : giv_ecrit_balise () */\n" \
11473  "/* */\n" \
11474  "/* But : ecrit une balise avec le nom des noeud et la valeur */\n" \
11475  "/* correspondante entre les balises. */\n" \
11476  "/* */\n" \
11477  "/* */\n" \
11478  "/* Entree(s) : un buffer, le contenu et le nom des balises */\n" \
11479  "/* */\n" \
11480  "/* Sortie(s) : OK ou KO */\n" \
11481  "/* */\n" \
11482  "/* Portable : Transparent */\n" \
11483  "/* */\n" \
11484  "/*----------------------------------------------------------------------------*/\n" \
11485  "\n" \
11486  "static int4 giv_ecrit_balise(char* buf, char* contenu, char* nom_balise)\n" \
11487  "{\n" \
11488  " int4 lg_ecr;\n" \
11489  " lg_ecr = 0;\n" \
11490  "\n" \
11491  " /* debut des methodes d'ecriture de balise simple*/\n" \
11492  " if ((strlen(contenu) > 0) || (0 == strcmp(\"ippal\", nom_balise)))\n" \
11493  " {\n" \
11494  " strcpy(buf, \"<\");\n" \
11495  " strcat(buf, nom_balise);\n" \
11496  "\n" \
11497  " if (0 == strcmp(\"ippal\", nom_balise))\n" \
11498  " {\n" \
11499  " strcat(buf, \" \");\n" \
11500  " strcat(buf, \"blocidlr\");\n" \
11501  " strcat(buf, \"=\");\n" \
11502  " strcat(buf, \"\\\"\");\n" \
11503  " strcat(buf, contenu);\n" \
11504  " strcat(buf, \"\\\"\");\n" \
11505  " strcat(buf, \">\");\n" \
11506  " strcat(buf, \"true\");\n" \
11507  " }\n" \
11508  " else\n" \
11509  " {\n" \
11510  " strcat(buf, \">\");\n" \
11511  " strcat(buf, contenu);\n" \
11512  " }\n" \
11513  "\n" \
11514  " strcat(buf, \"</\");\n" \
11515  " strcat(buf, nom_balise);\n" \
11516  " strcat(buf, \">\");\n" \
11517  " lg_ecr = strlen(buf);\n" \
11518  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
11519  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
11520  " *(buf + lg_ecr + 2) = '\\0';\n" \
11521  " lg_ecr += 2;\n" \
11522  " }\n" \
11523  " else if (0 == strcmp(\"bonplan_df\", nom_balise))\n" \
11524  " {\n" \
11525  " strcpy(buf, \"<\");\n" \
11526  " strcat(buf, nom_balise);\n" \
11527  " strcat(buf, \">\");\n" \
11528  " strcat(buf, \"</\");\n" \
11529  " strcat(buf, nom_balise);\n" \
11530  " strcat(buf, \">\");\n" \
11531  " lg_ecr = strlen(buf);\n" \
11532  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
11533  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
11534  " *(buf + lg_ecr + 2) = '\\0';\n" \
11535  " lg_ecr += 2;\n" \
11536  " }\n" \
11537  "\n" \
11538  " return (lg_ecr);\n" \
11539  "} /* fin des methodes d'ecriture de balise simple */\n" \
11540  "\n" \
11541  "/*----Fonction----------------------------------------------------------------*/\n" \
11542  "/* */\n" \
11543  "/* Fonction : giv_ecrit_balise_epj () */\n" \
11544  "/* */\n" \
11545  "/* But : ecrit une balise avec le nom des noeud et la valeur */\n" \
11546  "/* correspondante entre les balises avec traitement &,>,< */\n" \
11547  "/* */\n" \
11548  "/* */\n" \
11549  "/* Entree(s) : un buffer, le contenu et le nom des balises */\n" \
11550  "/* */\n" \
11551  "/* Sortie(s) : OK ou KO */\n" \
11552  "/* */\n" \
11553  "/* Portable : Transparent */\n" \
11554  "/* */\n" \
11555  "/*----------------------------------------------------------------------------*/\n" \
11556  "\n" \
11557  "static int4 giv_ecrit_balise_epj(char** buf_pos_in, char* contenu, char* nom_balise)\n" \
11558  "{\n" \
11559  " char* buf_pos;\n" \
11560  " int4 lg_ecr, i, j, iLg;\n" \
11561  " int4 iCodRet = GIV::GWCCodeOK;\n" \
11562  " lg_ecr = 0;\n" \
11563  " /* Initialisation pointeur */\n" \
11564  " buf_pos = *buf_pos_in;\n" \
11565  " iLg = strlen(contenu);\n" \
11566  "\n" \
11567  " if (strlen(contenu) > 0)\n" \
11568  " {\n" \
11569  " j = 0;\n" \
11570  "\n" \
11571  " for (i = 0; i < iLg; i++)\n" \
11572  " {\n" \
11573  " if ('<' == contenu[i])\n" \
11574  " {\n" \
11575  " GIVBuffInter[j] = '\\0';\n" \
11576  " strcat(GIVBuffInter, \"&lt;\");\n" \
11577  " j = strlen(GIVBuffInter);\n" \
11578  " }\n" \
11579  " else if ('>' == contenu[i])\n" \
11580  " {\n" \
11581  " GIVBuffInter[j] = '\\0';\n" \
11582  " strcat(GIVBuffInter, \"&gt;\");\n" \
11583  " j = strlen(GIVBuffInter);\n" \
11584  " }\n" \
11585  " else if ('\"' == contenu[i])\n" \
11586  " {\n" \
11587  " GIVBuffInter[j] = '\\0';\n" \
11588  " strcat(GIVBuffInter, \"&quot;\");\n" \
11589  " j = strlen(GIVBuffInter);\n" \
11590  " }\n" \
11591  " else if ('&' == contenu[i])\n" \
11592  " {\n" \
11593  " GIVBuffInter[j] = '\\0';\n" \
11594  " strcat(GIVBuffInter, givTrad);\n" \
11595  " j = strlen(GIVBuffInter);\n" \
11596  " }\n" \
11597  " else\n" \
11598  " {\n" \
11599  " GIVBuffInter[j] = contenu[i];\n" \
11600  " j++;\n" \
11601  " }\n" \
11602  " }\n" \
11603  "\n" \
11604  " GIVBuffInter[j] = '\\0';\n" \
11605  " /* conversion du XMLType */\n" \
11606  " (void)givConvClob();\n" \
11607  "\n" \
11608  " if (0 != strlen(nom_balise))\n" \
11609  " {\n" \
11610  " strcpy(buf_pos, \"<\");\n" \
11611  " strcat(buf_pos, nom_balise);\n" \
11612  " strcat(buf_pos, \">\");\n" \
11613  " }\n" \
11614  "\n" \
11615  " strcat(buf_pos, GIVBuffInter);\n" \
11616  "\n" \
11617  " if (0 != strlen(nom_balise))\n" \
11618  " {\n" \
11619  " strcat(buf_pos, \"</\");\n" \
11620  " strcat(buf_pos, nom_balise);\n" \
11621  " strcat(buf_pos, \">\");\n" \
11622  " lg_ecr = strlen(buf_pos);\n" \
11623  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
11624  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
11625  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
11626  " lg_ecr += 2;\n" \
11627  " }\n" \
11628  "\n" \
11629  " /* Ecriture dans le fichier de sortie sans changement de format */\n" \
11630  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
11631  " }\n" \
11632  "\n" \
11633  " *buf_pos_in = buf_pos;\n" \
11634  " return (lg_ecr);\n" \
11635  "}\n" \
11636  "\n" \
11637  "/*----Fonction----------------------------------------------------------------*/\n" \
11638  "/* */\n" \
11639  "/* Fonction : giv_ecrit_balise_iso () */\n" \
11640  "/* */\n" \
11641  "/* But : ecrit une balise avec le nom des noeud et la valeur */\n" \
11642  "/* correspondante entre les balises avec traitement &,>,< */\n" \
11643  "/* et traduction ASCIAE Iso */\n" \
11644  "/* */\n" \
11645  "/* Entree(s) : un buffer, le contenu et le nom des balises */\n" \
11646  "/* */\n" \
11647  "/* Sortie(s) : OK ou KO */\n" \
11648  "/* */\n" \
11649  "/* Portable : Transparent */\n" \
11650  "/* */\n" \
11651  "/*----------------------------------------------------------------------------*/\n" \
11652  "\n" \
11653  "static int4 giv_ecrit_balise_iso(char* buf_pos_in, char* contenu, char* nom_balise)\n" \
11654  "{\n" \
11655  " char* buf_pos;\n" \
11656  " int4 lg, lg_ecr, i, j;\n" \
11657  " int4 iCodRet = GIV::GWCCodeOK;\n" \
11658  " size_t lgInter, lg_in;\n" \
11659  " iconv_t iConv;\n" \
11660  " char* buf_in;\n" \
11661  " char* buf_out;\n" \
11662  " lg_ecr = 0;\n" \
11663  " /* Initialisation pointeur */\n" \
11664  " buf_pos = buf_pos_in;\n" \
11665  " lg = strlen(contenu);\n" \
11666  "\n" \
11667  " if (lg > 0)\n" \
11668  " {\n" \
11669  " strcpy(GIVBuffInter, contenu);\n" \
11670  " j = 0;\n" \
11671  "\n" \
11672  " for (i = 0; i < lg; i++)\n" \
11673  " {\n" \
11674  " if ('<' == GIVBuffInter[i])\n" \
11675  " {\n" \
11676  " GIVBuffClob[j] = '\\0';\n" \
11677  " strcat(GIVBuffClob, \"&lt;\");\n" \
11678  " j = strlen(GIVBuffClob);\n" \
11679  " }\n" \
11680  " else if ('>' == GIVBuffInter[i])\n" \
11681  " {\n" \
11682  " GIVBuffClob[j] = '\\0';\n" \
11683  " strcat(GIVBuffClob, \"&gt;\");\n" \
11684  " j = strlen(GIVBuffClob);\n" \
11685  " }\n" \
11686  " else if ('&' == GIVBuffInter[i])\n" \
11687  " {\n" \
11688  " GIVBuffClob[j] = '\\0';\n" \
11689  " strcat(GIVBuffClob, givTrad);\n" \
11690  " j = strlen(GIVBuffClob);\n" \
11691  " }\n" \
11692  " else\n" \
11693  " {\n" \
11694  " GIVBuffClob[j] = GIVBuffInter[i];\n" \
11695  " j++;\n" \
11696  " }\n" \
11697  " }\n" \
11698  "\n" \
11699  " GIVBuffClob[j] = '\\0';\n" \
11700  " /* Traduction UTF8 */\n" \
11701  " iConv = iconv_open(\"UTF-8\", \"ISO8859-1\");\n" \
11702  " buf_in = GIVBuffClob;\n" \
11703  " lg_in = strlen(GIVBuffClob) + 1;\n" \
11704  " buf_out = GIVBuffInter;\n" \
11705  " lgInter = sizeof(GIVBuffInter);\n" \
11706  "\n" \
11707  " if ((iconv_t)(-1) != iConv)\n" \
11708  " {\n" \
11709  " iconv(iConv, &buf_in, (size_t*)&lg_in, &buf_out, (size_t*)&lgInter);\n" \
11710  " iconv_close(iConv);\n" \
11711  " }\n" \
11712  "\n" \
11713  " GWTTrace(GWT_NIV_FONCT, (\"libellé iso: <%s>,%d\\n\", GIVBuffInter, lg));\n" \
11714  " strcpy(buf_pos, \"<\");\n" \
11715  " strcat(buf_pos, nom_balise);\n" \
11716  " strcat(buf_pos, \">\");\n" \
11717  " strcat(buf_pos, GIVBuffInter);\n" \
11718  " strcat(buf_pos, \"</\");\n" \
11719  " strcat(buf_pos, nom_balise);\n" \
11720  " strcat(buf_pos, \">\");\n" \
11721  " lg_ecr = strlen(buf_pos);\n" \
11722  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
11723  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
11724  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
11725  " lg_ecr += 2;\n" \
11726  " /* Pas d'Ecriture dans le fichier de sortie sans changement de format */\n" \
11727  " }\n" \
11728  "\n" \
11729  " GWTTrace(GWT_NIV_FONCT, (\"Buffer iso: <%s>,%d\\n\", buf_pos, lg));\n" \
11730  " return (lg_ecr);\n" \
11731  "}\n" \
11732  "\n" \
11733  "/*----Fonction----------------------------------------------------------------*/\n" \
11734  "/* */\n" \
11735  "/* Fonction : giv_ecrit_noeud_simple () */\n" \
11736  "/* */\n" \
11737  "/* But : ecrit un noeud avec le nom du noeud */\n" \
11738  "/* */\n" \
11739  "/* */\n" \
11740  "/* Entree(s) : un buffer, le nom du noeud */\n" \
11741  "/* */\n" \
11742  "/* Sortie(s) : OK ou KO */\n" \
11743  "/* */\n" \
11744  "/* Portable : Transparent */\n" \
11745  "/* */\n" \
11746  "/*----------------------------------------------------------------------------*/\n" \
11747  "\n" \
11748  "static int4 giv_ecrit_noeud_simple(char* buf, char* nom_noeud)\n" \
11749  "{\n" \
11750  " int4 lg_ecr;\n" \
11751  "\n" \
11752  " if (strlen(nom_noeud) == 0)\n" \
11753  " return (0);\n" \
11754  "\n" \
11755  " if (strlen(nom_noeud) > 0)\n" \
11756  " {\n" \
11757  " strcpy(buf, \"<\");\n" \
11758  " strcat(buf, nom_noeud);\n" \
11759  " strcat(buf, \">\");\n" \
11760  " }\n" \
11761  "\n" \
11762  " lg_ecr = strlen(buf);\n" \
11763  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
11764  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
11765  " *(buf + lg_ecr + 2) = '\\0';\n" \
11766  " return (lg_ecr + 2);\n" \
11767  "} /* Fin ecrire noeud simple */\n" \
11768  "\n" \
11769  "/*----Fonction----------------------------------------------------------------*/\n" \
11770  "/* */\n" \
11771  "/* Fonction : giv_ecrit_noeud_attr () */\n" \
11772  "/* */\n" \
11773  "/* But : ecrit un noeud avec le nom du noeud */\n" \
11774  "/* */\n" \
11775  "/* */\n" \
11776  "/* Entree(s) : un buffer, le nom du noeud */\n" \
11777  "/* */\n" \
11778  "/* Sortie(s) : OK ou KO */\n" \
11779  "/* */\n" \
11780  "/* Portable : Transparent */\n" \
11781  "/* */\n" \
11782  "/*----------------------------------------------------------------------------*/\n" \
11783  "\n" \
11784  "static int4 giv_ecrit_noeud_attr(char* buf, char* nom_noeud, char* val)\n" \
11785  "{\n" \
11786  " int4 lg_ecr;\n" \
11787  "\n" \
11788  " if ((0 == strcmp(nom_noeud, \"equipe\")) && (0 != strlen(val)))\n" \
11789  " {\n" \
11790  " strcpy(buf, \"<\");\n" \
11791  " strcat(buf, nom_noeud);\n" \
11792  " strcat(buf, \" cle=\\\"\");\n" \
11793  " strcat(buf, val);\n" \
11794  " strcat(buf, \"\\\">\");\n" \
11795  " }\n" \
11796  " else if ((0 == strcmp(nom_noeud, \"services\")) && (0 != strlen(val)))\n" \
11797  " {\n" \
11798  " strcpy(buf, \"<\");\n" \
11799  " strcat(buf, nom_noeud);\n" \
11800  " strcat(buf, \" cle=\\\"\");\n" \
11801  " strcat(buf, val);\n" \
11802  " strcat(buf, \"\\\">\");\n" \
11803  " }\n" \
11804  " else if ((0 == strcmp(nom_noeud, \"cle\")) && (0 != strlen(val)))\n" \
11805  " {\n" \
11806  " strcpy(buf, \"<\");\n" \
11807  " strcat(buf, nom_noeud);\n" \
11808  " strcat(buf, \" type=\\\"PJDOC\\\">\");\n" \
11809  " strcat(buf, val);\n" \
11810  " strcat(buf, \"</\");\n" \
11811  " strcat(buf, nom_noeud);\n" \
11812  " strcat(buf, \">\");\n" \
11813  " }\n" \
11814  " else if (strlen(nom_noeud) > 0)\n" \
11815  " {\n" \
11816  " strcpy(buf, \"<\");\n" \
11817  " strcat(buf, nom_noeud);\n" \
11818  " strcat(buf, \">\");\n" \
11819  " }\n" \
11820  "\n" \
11821  " lg_ecr = strlen(buf);\n" \
11822  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
11823  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
11824  " *(buf + lg_ecr + 2) = '\\0';\n" \
11825  " return (lg_ecr + 2);\n" \
11826  "} /* Fin ecrire noeud simple */\n" \
11827  "\n" \
11828  "/*----Fonction----------------------------------------------------------------*/\n" \
11829  "/* */\n" \
11830  "/* Fonction : giv_ecrit_fin_noeud () */\n" \
11831  "/* */\n" \
11832  "/* But : ecrit la fin d'un noeud avec le nom du noeud */\n" \
11833  "/* */\n" \
11834  "/* */\n" \
11835  "/* Entree(s) : un buffer, le nom du noeud */\n" \
11836  "/* */\n" \
11837  "/* Sortie(s) : OK ou KO */\n" \
11838  "/* */\n" \
11839  "/* Portable : Transparent */\n" \
11840  "/* */\n" \
11841  "/*----------------------------------------------------------------------------*/\n" \
11842  "\n" \
11843  "static int4 giv_ecrit_fin_noeud(char** buf_pos_in, char* nom_noeud)\n" \
11844  "{\n" \
11845  " int4 lg_ecr;\n" \
11846  " char* buf_pos;\n" \
11847  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
11848  " /* Initialisation pointeur */\n" \
11849  " buf_pos = *buf_pos_in;\n" \
11850  "\n" \
11851  " if (strlen(nom_noeud) == 0)\n" \
11852  " return (0);\n" \
11853  "\n" \
11854  " if (0 == strcmp(\"document\", nom_noeud))\n" \
11855  " {\n" \
11856  " strcpy(buf_pos, \"</\");\n" \
11857  " strcat(buf_pos, \"blocepj\");\n" \
11858  " strcat(buf_pos, \">\");\n" \
11859  " lg_ecr = strlen(buf_pos);\n" \
11860  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
11861  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
11862  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
11863  " lg_ecr = lg_ecr + 2;\n" \
11864  " buf_pos = (buf_pos + lg_ecr);\n" \
11865  " /* Ecriture dans le fichier de sortie */\n" \
11866  " iIntRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
11867  " strcpy(buf_pos, \"</\");\n" \
11868  " strcat(buf_pos, \"CONTENT\");\n" \
11869  " strcat(buf_pos, \">\");\n" \
11870  " lg_ecr = strlen(buf_pos);\n" \
11871  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
11872  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
11873  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
11874  " lg_ecr = lg_ecr + 2;\n" \
11875  " buf_pos = (buf_pos + lg_ecr);\n" \
11876  " strcpy(buf_pos, \"</\");\n" \
11877  " strcat(buf_pos, \"OPERATION\");\n" \
11878  " strcat(buf_pos, \">\");\n" \
11879  " lg_ecr = strlen(buf_pos);\n" \
11880  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
11881  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
11882  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
11883  " lg_ecr = lg_ecr + 2;\n" \
11884  " buf_pos = (buf_pos + lg_ecr);\n" \
11885  " }\n" \
11886  " else if (0 == strcmp(\"documents\", nom_noeud))\n" \
11887  " {\n" \
11888  " strcpy(buf_pos, \"</\");\n" \
11889  " strcat(buf_pos, \"OPERATIONS\");\n" \
11890  " strcat(buf_pos, \">\");\n" \
11891  " lg_ecr = strlen(buf_pos);\n" \
11892  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
11893  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
11894  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
11895  " lg_ecr = lg_ecr + 2;\n" \
11896  " }\n" \
11897  " else\n" \
11898  " {\n" \
11899  " if (strlen(nom_noeud) > 0)\n" \
11900  " {\n" \
11901  " strcpy(buf_pos, \"</\");\n" \
11902  " strcat(buf_pos, nom_noeud);\n" \
11903  " strcat(buf_pos, \">\");\n" \
11904  " }\n" \
11905  "\n" \
11906  " lg_ecr = strlen(buf_pos);\n" \
11907  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
11908  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
11909  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
11910  " lg_ecr = lg_ecr + 2;\n" \
11911  " }\n" \
11912  "\n" \
11913  " *buf_pos_in = buf_pos;\n" \
11914  " return (lg_ecr);\n" \
11915  "} /* Fin ecrire fin noeud */\n" \
11916  "\n" \
11917  "/*----Fonction----------------------------------------------------------------*/\n" \
11918  "/* */\n" \
11919  "/* Fonction : giv_ecrit_noeud () */\n" \
11920  "/* */\n" \
11921  "/* But : ecrit un noeud avec le nom du noeud et son contenu */\n" \
11922  "/* */\n" \
11923  "/* */\n" \
11924  "/* Entree(s) : un buffer, contenu du noeud, le nom du noeud, denomination */\n" \
11925  "/* */\n" \
11926  "/* Sortie(s) : OK ou KO */\n" \
11927  "/* */\n" \
11928  "/* Portable : Transparent */\n" \
11929  "/* */\n" \
11930  "/*----------------------------------------------------------------------------*/\n" \
11931  "\n" \
11932  "static int4 giv_ecrit_noeud(char* buf, char* contenu_noeud, char* nom_noeud, char* name)\n" \
11933  "{\n" \
11934  " int4 lg_ecr;\n" \
11935  "\n" \
11936  " if ((0 == memcmp(\"aff\", contenu_noeud, strlen(\"aff\"))) || (0 == memcmp(\"anot\", contenu_noeud, strlen(\"anot\"))))\n" \
11937  " {\n" \
11938  " strcpy(buf, \"<\");\n" \
11939  " strcat(buf, contenu_noeud);\n" \
11940  " strcat(buf, \">\");\n" \
11941  " }\n" \
11942  " else if (strlen(name) > 0)\n" \
11943  " {\n" \
11944  " strcpy(buf, \"<\");\n" \
11945  " strcat(buf, nom_noeud);\n" \
11946  " strcat(buf, \" \");\n" \
11947  " strcat(buf, name);\n" \
11948  " strcat(buf, \"=\");\n" \
11949  " strcat(buf, \"\\\"\");\n" \
11950  " strcat(buf, contenu_noeud);\n" \
11951  " strcat(buf, \"\\\"\");\n" \
11952  " strcat(buf, \">\");\n" \
11953  " }\n" \
11954  " else\n" \
11955  " {\n" \
11956  " strcpy(buf, \"<\");\n" \
11957  " strcat(buf, nom_noeud);\n" \
11958  " strcat(buf, \">\");\n" \
11959  " }\n" \
11960  "\n" \
11961  " lg_ecr = strlen(buf);\n" \
11962  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
11963  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
11964  " *(buf + lg_ecr + 2) = '\\0';\n" \
11965  " return (lg_ecr + 2);\n" \
11966  "} /* Fin ecrire noeud */\n" \
11967  "\n" \
11968  "/*----Fonction----------------------------------------------------------------*/\n" \
11969  "/* */\n" \
11970  "/* Fonction : giv_ecrit_element () */\n" \
11971  "/* */\n" \
11972  "/* But : ecrit un element avec le nom de l'element et */\n" \
11973  "/* une balise simple suivi de son contenu */\n" \
11974  "/* */\n" \
11975  "/* Entree(s) : un buffer, le nom d'element, valeur */\n" \
11976  "/* */\n" \
11977  "/* Sortie(s) : OK ou KO */\n" \
11978  "/* */\n" \
11979  "/* Portable : Transparent */\n" \
11980  "/* */\n" \
11981  "/*----------------------------------------------------------------------------*/\n" \
11982  "\n" \
11983  "static int4 giv_ecrit_element(char* buf, char* nom, char* valeur)\n" \
11984  "{\n" \
11985  " int4 lg_ecr, lg_write, lg_bal, lg_cpy;\n" \
11986  " char* buf_bis = buf;\n" \
11987  " char* buf_be = buf;\n" \
11988  " int4 iRet;\n" \
11989  " lg_ecr = 0;\n" \
11990  "\n" \
11991  " /* S'il y a un mot a ecrire */\n" \
11992  " if ((strlen(nom) > 0) && (strlen(valeur) > 0))\n" \
11993  " {\n" \
11994  " /* Ecrire la balise */\n" \
11995  " if ((0 == memcmp(\"pjdep\", nom, strlen(\"pjdep\"))) || (0 == memcmp(\"pjreg\", nom, strlen(\"pjreg\"))) || (0 == memcmp(\"ipjdep\", nom, strlen(\"ipjdep\"))) || (0 == memcmp(\"ipjreg\", nom, strlen(\"ipjreg\")))\n" \
11996  " || (NULL != strstr(nom, \"crc\")) || (0 == memcmp(\"pjmotsrubriques\", nom, strlen(\"pjmotsrubriques\"))) || (0 == memcmp(\"pjmotcontenus\", nom, strlen(\"pjmotcontenus\")))\n" \
11997  " || (0 == memcmp(\"pjmotscontenusnormalise\", nom, strlen(\"pjmotscontenusnormalise\"))) || (0 == memcmp(\"pjmotscles\", nom, strlen(\"pjmotscles\"))))\n" \
11998  " {\n" \
11999  " /* suppression des doubles géographiques/an9 */\n" \
12000  " iRet = supprimer_doublon(valeur, '|');\n" \
12001  " }\n" \
12002  " else if (0 == memcmp(\"pjrubriques\", nom, strlen(\"pjrubriques\")))\n" \
12003  " {\n" \
12004  " /* suppression des doubles géographiques/an9 */\n" \
12005  " iRet = supprimer_doublon(valeur, '|');\n" \
12006  " }\n" \
12007  "\n" \
12008  " lg_ecr = giv_ecrit_balise(buf_bis, valeur, nom);\n" \
12009  " }\n" \
12010  "\n" \
12011  " return (lg_ecr);\n" \
12012  "} /* Fin ecrire element */\n" \
12013  "\n" \
12014  "/*----------------------------------Fonction----------------------------------*\n" \
12015  " * Fonction : givEcritureEtab\n" \
12016  " *\n" \
12017  " * But : champs du siret.\n" \
12018  " *\n" \
12019  " * Description : Lecture\n" \
12020  " * dans la table GYTtabPeeatb.\n" \
12021  " *\n" \
12022  " *\n" \
12023  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
12024  "\n" \
12025  "int4 givEcritureEtab(GYBrDOCUMENTEpj* doc, char** buf_pos_in, int4* apiDeb)\n" \
12026  "{\n" \
12027  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
12028  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
12029  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
12030  " int4 lg_ecr;\n" \
12031  " char* buf_pos;\n" \
12032  " EXEC SQL\n" \
12033  " begin declare\n" \
12034  " section;\n" \
12035  " GYBrPeEtabT rEtab;\n" \
12036  " GYBrIndPeEtabT rIndEtab;\n" \
12037  " EXEC SQL\n" \
12038  " end declare\n" \
12039  " section;\n" \
12040  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
12041  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
12042  " (void)strcpy(rEtab.acEtab, doc->value.a_classer.etab);\n" \
12043  " lg_ecr = 0;\n" \
12044  " /* Initialisation pointeur */\n" \
12045  " buf_pos = *buf_pos_in;\n" \
12046  " doc->value.a_classer.opphoto = '\\0';\n" \
12047  " doc->value.a_classer.parinsee = '0';\n" \
12048  " /* Traitement des erreurs SQL */\n" \
12049  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureEtab\");\n" \
12050  " EXEC SQL\n" \
12051  " OPEN crsLectureEtab\n" \
12052  " USING: rEtab.acEtab;\n" \
12053  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12054  "\n" \
12055  " if ((int4)GIV::GYBok != iIntRet)\n" \
12056  " {\n" \
12057  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
12058  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12059  " }\n" \
12060  "\n" \
12061  " if ((int4)GIV::GYBok == iIntRet)\n" \
12062  " {\n" \
12063  " EXEC SQL\n" \
12064  " FETCH crsLectureEtab\n" \
12065  " INTO\n" \
12066  " :rEtab.acDenom\n" \
12067  " :rIndEtab.sDenomI,\n" \
12068  " :rEtab.acNomDirgt:rIndEtab.sNomDirgtI,\n" \
12069  " :rEtab.acParInsee,\n" \
12070  " :rEtab.acRS:rIndEtab.sRSI,\n" \
12071  " :rEtab.acRSCompl:rIndEtab.sRSComplI,\n" \
12072  " :rEtab.acEnsgne:rIndEtab.sEnsgneI,\n" \
12073  " :rEtab.acSigle:rIndEtab.sSigleI,\n" \
12074  " :rEtab.acOppPhoto;\n" \
12075  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12076  "\n" \
12077  " if ((int4)GIV::GYBok == iIntRet)\n" \
12078  " {\n" \
12079  " doc->value.a_classer.opphoto = rEtab.acOppPhoto;\n" \
12080  " doc->value.a_classer.parinsee = rEtab.acParInsee;\n" \
12081  "\n" \
12082  " if (1 == *apiDeb)\n" \
12083  " *apiDeb = 0;\n" \
12084  "\n" \
12085  " if ('1' != rEtab.acParInsee)\n" \
12086  " {\n" \
12087  " /* opposition sur les données Insee */\n" \
12088  " rIndEtab.sRSI = (int4)GIV::GYBnok;\n" \
12089  " rIndEtab.sEnsgneI = (int4)GIV::GYBnok;\n" \
12090  " rIndEtab.sSigleI = (int4)GIV::GYBnok;\n" \
12091  " rIndEtab.sRSComplI = (int4)GIV::GYBnok;\n" \
12092  " }\n" \
12093  "\n" \
12094  " strcpy(buf_pos, \"<intitulesiret etab=\\\"\");\n" \
12095  " strcat(buf_pos, doc->value.a_classer.etab);\n" \
12096  " strcat(buf_pos, \"\\\">\");\n" \
12097  " lg_ecr = strlen(buf_pos);\n" \
12098  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
12099  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
12100  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
12101  " lg_ecr = lg_ecr + 2;\n" \
12102  " buf_pos = (buf_pos + lg_ecr);\n" \
12103  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
12104  "\n" \
12105  " if ((int4)GIV::GYBok == rIndEtab.sNomDirgtI)\n" \
12106  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rEtab.acNomDirgt, \"nomdirigeant\");\n" \
12107  "\n" \
12108  " if ((int4)GIV::GYBok == rIndEtab.sRSI)\n" \
12109  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rEtab.acRS, \"siretrs\");\n" \
12110  "\n" \
12111  " if ((int4)GIV::GYBok == rIndEtab.sRSComplI)\n" \
12112  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rEtab.acRSCompl, \"siretrscompl\");\n" \
12113  "\n" \
12114  " if ((int4)GIV::GYBok == rIndEtab.sEnsgneI)\n" \
12115  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rEtab.acEnsgne, \"siretenseigne\");\n" \
12116  "\n" \
12117  " if ((int4)GIV::GYBok == rIndEtab.sSigleI)\n" \
12118  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rEtab.acSigle, \"siretsigle\");\n" \
12119  "\n" \
12120  " lg_ecr = giv_ecrit_fin_noeud(&buf_pos, \"intitulesiret\");\n" \
12121  " buf_pos = buf_pos + lg_ecr;\n" \
12122  " }\n" \
12123  "\n" \
12124  " *buf_pos_in = buf_pos;\n" \
12125  " }\n" \
12126  "\n" \
12127  " EXEC SQL\n" \
12128  " close crsLectureEtab;\n" \
12129  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12130  "\n" \
12131  " if ((int4)GIV::GYBok != iIntRet)\n" \
12132  " {\n" \
12133  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
12134  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12135  " }\n" \
12136  "\n" \
12137  " return (iCodRet);\n" \
12138  "}\n" \
12139  "\n" \
12140  "/*----------------------------------Fonction----------------------------------*\n" \
12141  " * Fonction : givEcritureDenomEtab\n" \
12142  " *\n" \
12143  " * But : champs de dénominations secondaires.\n" \
12144  " *\n" \
12145  " * Description : Lecture\n" \
12146  " * dans la table GYTtabDenomsEtab.\n" \
12147  " *\n" \
12148  " *\n" \
12149  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
12150  "\n" \
12151  "int4 givEcritureDenomEtab(GYBrDOCUMENTEpj* doc, char** buf_pos_in, int4* apiDeb)\n" \
12152  "{\n" \
12153  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
12154  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
12155  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
12156  " int4 lg_ecr, i, j;\n" \
12157  " char* buf_pos;\n" \
12158  " EXEC SQL\n" \
12159  " begin declare\n" \
12160  " section;\n" \
12161  " GYBrPeEtabT rEtab;\n" \
12162  " EXEC SQL\n" \
12163  " end declare\n" \
12164  " section;\n" \
12165  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
12166  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
12167  " (void)strcpy(rEtab.acEtab, doc->value.a_classer.etab);\n" \
12168  " lg_ecr = 0;\n" \
12169  " /* Initialisation pointeur */\n" \
12170  " buf_pos = *buf_pos_in;\n" \
12171  " /* Traitement des erreurs SQL */\n" \
12172  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureDenomEtab\");\n" \
12173  " EXEC SQL\n" \
12174  " OPEN crsLectureDenomEtab\n" \
12175  " USING: rEtab.acEtab;\n" \
12176  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12177  "\n" \
12178  " if ((int4)GIV::GYBok != iIntRet)\n" \
12179  " {\n" \
12180  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureDenomEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
12181  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12182  " }\n" \
12183  "\n" \
12184  " /* écriture utf8 */\n" \
12185  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
12186  "\n" \
12187  " while ((int4)GIV::GYBok == iIntRet)\n" \
12188  " {\n" \
12189  " EXEC SQL\n" \
12190  " FETCH crsLectureDenomEtab\n" \
12191  " INTO\n" \
12192  " :rEtab.acParInsee,\n" \
12193  " :rEtab.acDenom;\n" \
12194  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12195  "\n" \
12196  " if ((int4)GIV::GYBok == iIntRet)\n" \
12197  " {\n" \
12198  " if ('6' != rEtab.acParInsee)\n" \
12199  " {\n" \
12200  " /* seul libref traité */\n" \
12201  " continue;\n" \
12202  " }\n" \
12203  "\n" \
12204  " if (1 == *apiDeb)\n" \
12205  " {\n" \
12206  " strcpy(buf_pos, \"<intitulelibref etab=\\\"\");\n" \
12207  " strcat(buf_pos, rEtab.acEtab);\n" \
12208  " strcat(buf_pos, \"\\\">\");\n" \
12209  " lg_ecr = strlen(buf_pos);\n" \
12210  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
12211  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
12212  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
12213  " lg_ecr = lg_ecr + 2;\n" \
12214  " buf_pos = (buf_pos + lg_ecr);\n" \
12215  " /* écriture utf8 */\n" \
12216  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
12217  " *apiDeb = 0;\n" \
12218  " }\n" \
12219  "\n" \
12220  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rEtab.acDenom, \"denomlibref\");\n" \
12221  " }\n" \
12222  " }\n" \
12223  "\n" \
12224  " EXEC SQL\n" \
12225  " close crsLectureDenomEtab;\n" \
12226  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12227  "\n" \
12228  " if ((int4)GIV::GYBok != iIntRet)\n" \
12229  " {\n" \
12230  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureDenomEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
12231  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12232  " }\n" \
12233  "\n" \
12234  " if (0 == *apiDeb)\n" \
12235  " {\n" \
12236  " lg_ecr = giv_ecrit_fin_noeud(&buf_pos, \"intitulelibref\");\n" \
12237  " buf_pos = buf_pos + lg_ecr;\n" \
12238  " }\n" \
12239  "\n" \
12240  " *buf_pos_in = buf_pos;\n" \
12241  " GWTTrace(GWT_NIV_FONCT, (\"crsLectureDenomEtab: <%s> <%c>]\\n\", doc->value.a_classer.etab, doc->value.a_classer.parinsee));\n" \
12242  " return (iCodRet);\n" \
12243  "}\n" \
12244  "\n" \
12245  "/*----------------------------------Fonction----------------------------------*\n" \
12246  " * Fonction : givLectureObjetsEtab\n" \
12247  " *\n" \
12248  " * But : champs des objets pub de l'établissement.\n" \
12249  " *\n" \
12250  " * Description : Lecture\n" \
12251  " * dans la table GYTtabPeeatb.\n" \
12252  " *\n" \
12253  " *\n" \
12254  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
12255  "\n" \
12256  "int4 givLectureObjetsEtab(char* apcEtab, GYBrDOCUMENTEpj* doc, int4 iNb)\n" \
12257  "{\n" \
12258  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
12259  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
12260  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
12261  " EXEC SQL\n" \
12262  " begin declare\n" \
12263  " section;\n" \
12264  " char* pcOraEtab;\n" \
12265  " GYBrIamicT rIamicEtab;\n" \
12266  " GYBrIamicT rIamicClient;\n" \
12267  " GYBrIndIamicT rIndIamic;\n" \
12268  " EXEC SQL\n" \
12269  " VAR pcOraEtab\n" \
12270  " IS STRING;\n" \
12271  " EXEC SQL\n" \
12272  " end declare\n" \
12273  " section;\n" \
12274  " time_t date;\n" \
12275  " int4 i, j, x, y, z, iRef;\n" \
12276  " GYBrIapartT rIapart;\n" \
12277  " int4 iPJDC, iCHRO;\n" \
12278  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
12279  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
12280  " iPJDC = -1;\n" \
12281  " iCHRO = GIV::GIXCodeKO;\n" \
12282  " pcOraEtab = apcEtab;\n" \
12283  " /* Traitement des erreurs SQL */\n" \
12284  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLecturePubEtab\");\n" \
12285  " EXEC SQL\n" \
12286  " OPEN crsLecturePubEtab\n" \
12287  " USING :pcOraEtab,\n" \
12288  " :pcOraEtab,\n" \
12289  " :pcOraEtab;\n" \
12290  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12291  "\n" \
12292  " if ((int4)GIV::GYBok != iIntRet)\n" \
12293  " {\n" \
12294  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLecturePubEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
12295  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12296  " }\n" \
12297  "\n" \
12298  " while ((int4)GIV::GYBok == iIntRet)\n" \
12299  " {\n" \
12300  " EXEC SQL\n" \
12301  " FETCH crsLecturePubEtab\n" \
12302  " INTO\n" \
12303  " :rIamicEtab.acNumobj\n" \
12304  " :rIndIamic.sNumobjI,\n" \
12305  " :rIamicEtab.acTpdsob,\n" \
12306  " :rIamicEtab.acStobj,\n" \
12307  " :rIamicClient.acNumobj:rIndIamic.sNumobjI,\n" \
12308  " :rIamicEtab.acDatact:rIndIamic.sDatactI;\n" \
12309  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12310  "\n" \
12311  " if ((int4)GIV::GYBok == iIntRet)\n" \
12312  " {\n" \
12313  " nb_micro = doc->value.objets_pub.nb_micro;\n" \
12314  "\n" \
12315  " if ((0 == strcmp(rIamicEtab.acTpdsob, giv_sCHRO)) && (0 == strcmp(rIamicEtab.acStobj, giv_ssCHRO)) && (NULL == strstr(givtcFourPart, giv_CHRO)))\n" \
12316  " {\n" \
12317  " /* protection car LC-CH remplacé par le partenaire CHRONORESTO */\n" \
12318  " continue;\n" \
12319  " }\n" \
12320  "\n" \
12321  " if ((0 == strcmp(rIamicEtab.acTpdsob, giv_sPJDC)) && (0 == strcmp(rIamicEtab.acStobj, giv_ssPJDC)) && (NULL == strstr(givtcFourPart, giv_PJDC)))\n" \
12322  " {\n" \
12323  " /* protection car LP-CR remplacé par le partenaire PJDOC */\n" \
12324  " iPJDC = nb_micro;\n" \
12325  " }\n" \
12326  "\n" \
12327  " if (-1 == rIndIamic.sDatactI)\n" \
12328  " rIamicEtab.acDatact[0] = '\\0';\n" \
12329  "\n" \
12330  " if (-1 == rIndIamic.sNumobjI)\n" \
12331  " {\n" \
12332  " strcpy(rIamicEtab.acNumobj, \"0002\");\n" \
12333  " strcat(rIamicEtab.acNumobj, apcEtab);\n" \
12334  " strcat(rIamicEtab.acNumobj, \"0001\");\n" \
12335  " date = time(NULL);\n" \
12336  " (void)strftime(rIamicEtab.acDatact, sizeof(rIamicEtab.acDatact), \"%Y%m%d\", localtime(&date));\n" \
12337  " }\n" \
12338  "\n" \
12339  " strcpy(doc->value.objets_pub.micro[nb_micro].type, \"X\");\n" \
12340  " strcpy(doc->value.objets_pub.micro[nb_micro].stype, rIamicEtab.acTpdsob);\n" \
12341  " strcpy(doc->value.objets_pub.micro[nb_micro].sstype, rIamicEtab.acStobj);\n" \
12342  " strcpy(doc->value.objets_pub.micro[nb_micro].id, rIamicEtab.acNumobj);\n" \
12343  " strcpy(doc->value.objets_pub.micro[nb_micro].tcdatact, rIamicEtab.acDatact);\n" \
12344  " doc->value.objets_pub.micro[nb_micro].valeur[0] = '\\0';\n" \
12345  " doc->value.objets_pub.micro[nb_micro].iCVI = 0;\n" \
12346  " doc->value.objets_pub.micro[nb_micro].stypcvi[0] = '\\0';\n" \
12347  " strcpy(doc->value.objets_pub.micro[nb_micro].stypint, rIamicEtab.acTpdsob);\n" \
12348  " GWTTrace(GWT_NIV_FONCT, (\"Objet etab : %s,%s,%s\\n\", rIamicEtab.acTpdsob, rIamicEtab.acStobj, rIamicEtab.acNumobj));\n" \
12349  " nb_micro++;\n" \
12350  " doc->value.objets_pub.nb_micro = nb_micro;\n" \
12351  " }\n" \
12352  " }\n" \
12353  "\n" \
12354  " EXEC SQL\n" \
12355  " close crsLecturePubEtab;\n" \
12356  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12357  "\n" \
12358  " if ((int4)GIV::GYBok != iIntRet)\n" \
12359  " {\n" \
12360  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLecturePubEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
12361  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12362  " }\n" \
12363  "\n" \
12364  " /* ajout de l'objet LC-CH pour le partenaire CHRONORESTO */\n" \
12365  " for (x = 0; x < iNb; x++)\n" \
12366  " {\n" \
12367  " for (i = 0; i < (doc + x)->value.a_classer.iNbPart; i++)\n" \
12368  " {\n" \
12369  " iRef = strlen((doc + x)->value.a_classer.trpart[i].rpart);\n" \
12370  " (void)strcpy(rIapart.acOriPart, &(doc + x)->value.a_classer.trpart[i].rpart[iRef - 4]);\n" \
12371  "\n" \
12372  " if (((0 == strcmp(rIapart.acOriPart, giv_CHRO)) && (NULL == strstr(givtcFourPart, rIapart.acOriPart)) && (GIV::GIXCodeKO == iCHRO)) || ((0 == strcmp(rIapart.acOriPart, giv_PJDC))\n" \
12373  " && (NULL == strstr(givtcFourPart, rIapart.acOriPart)) && (-1 == iPJDC)))\n" \
12374  " {\n" \
12375  " nb_micro = doc->value.objets_pub.nb_micro;\n" \
12376  " strcpy(doc->value.objets_pub.micro[nb_micro].type, \"X\");\n" \
12377  " strcpy(rIamicEtab.acNumobj, \"0002\");\n" \
12378  " strcat(rIamicEtab.acNumobj, apcEtab);\n" \
12379  " strcat(rIamicEtab.acNumobj, \"0001\");\n" \
12380  " date = time(NULL);\n" \
12381  " (void)strftime(rIamicEtab.acDatact, sizeof(rIamicEtab.acDatact), \"%Y%m%d\", localtime(&date));\n" \
12382  "\n" \
12383  " if (0 == strcmp(rIapart.acOriPart, giv_CHRO))\n" \
12384  " {\n" \
12385  " strcpy(doc->value.objets_pub.micro[nb_micro].stype, giv_sCHRO);\n" \
12386  " strcpy(doc->value.objets_pub.micro[nb_micro].sstype, giv_ssCHRO);\n" \
12387  " doc->value.objets_pub.micro[nb_micro].valeur[0] = '\\0';\n" \
12388  " iCHRO = GIV::GIXCodeOK;\n" \
12389  " }\n" \
12390  " else\n" \
12391  " {\n" \
12392  " strcpy(doc->value.objets_pub.micro[nb_micro].stype, giv_sPJDC);\n" \
12393  " strcpy(doc->value.objets_pub.micro[nb_micro].sstype, giv_ssPJDC);\n" \
12394  " iRef -= 4;\n" \
12395  "\n" \
12396  " for (y = 0; (y < iRef && 0 == isdigit((doc + x)->value.a_classer.trpart[i].rpart[y])); y++)\n" \
12397  " ;\n" \
12398  "\n" \
12399  " for (z = y; (z < iRef && 0 != isdigit((doc + x)->value.a_classer.trpart[i].rpart[z])); z++)\n" \
12400  " ;\n" \
12401  "\n" \
12402  " (void)memcpy(doc->value.objets_pub.micro[nb_micro].valeur, &(doc + x)->value.a_classer.trpart[i].rpart[y], z - y);\n" \
12403  " doc->value.objets_pub.micro[nb_micro].valeur[z - y] = '\\0';\n" \
12404  " iPJDC = nb_micro;\n" \
12405  " }\n" \
12406  "\n" \
12407  " strcpy(doc->value.objets_pub.micro[nb_micro].id, rIamicEtab.acNumobj);\n" \
12408  " strcpy(doc->value.objets_pub.micro[nb_micro].tcdatact, rIamicEtab.acDatact);\n" \
12409  " doc->value.objets_pub.micro[nb_micro].iCVI = 0;\n" \
12410  " doc->value.objets_pub.micro[nb_micro].stypcvi[0] = '\\0';\n" \
12411  " strcpy(doc->value.objets_pub.micro[nb_micro].stypint, doc->value.objets_pub.micro[nb_micro].stype);\n" \
12412  " nb_micro++;\n" \
12413  " doc->value.objets_pub.nb_micro = nb_micro;\n" \
12414  " }\n" \
12415  " else if ((0 == strcmp(rIapart.acOriPart, giv_PJDC)) && (NULL == strstr(givtcFourPart, rIapart.acOriPart)) && (-1 != iPJDC))\n" \
12416  " {\n" \
12417  " GWTTrace(GWT_NIV_FONCT, (\"LP CR modifié pour PJDC %d, %s\\n\", iPJDC, (doc + x)->value.a_classer.trpart[i].rpart));\n" \
12418  " strcpy(rIamicEtab.acNumobj, \"0002\");\n" \
12419  " strcat(rIamicEtab.acNumobj, apcEtab);\n" \
12420  " strcat(rIamicEtab.acNumobj, \"0001\");\n" \
12421  " strcpy(doc->value.objets_pub.micro[iPJDC].id, rIamicEtab.acNumobj);\n" \
12422  " iRef -= 4;\n" \
12423  "\n" \
12424  " for (y = 0; (y < iRef && 0 == isdigit((doc + x)->value.a_classer.trpart[i].rpart[y])); y++)\n" \
12425  " ;\n" \
12426  "\n" \
12427  " for (z = y; (z < iRef && 0 != isdigit((doc + x)->value.a_classer.trpart[i].rpart[z])); z++)\n" \
12428  " ;\n" \
12429  "\n" \
12430  " (void)memcpy(doc->value.objets_pub.micro[nb_micro].valeur, &(doc + x)->value.a_classer.trpart[i].rpart[y], z - y);\n" \
12431  " doc->value.objets_pub.micro[nb_micro].valeur[z - y] = '\\0';\n" \
12432  " }\n" \
12433  " }\n" \
12434  "\n" \
12435  " if ((GIV::GIXCodeOK == iCHRO) && (-1 != iPJDC))\n" \
12436  " break;\n" \
12437  " }\n" \
12438  "\n" \
12439  " for (i = 0; (i < iNb && -1 != iPJDC); i++)\n" \
12440  " {\n" \
12441  " /* recherche de l'existence d'une rubrique de type santé pour PJDOC */\n" \
12442  " for (j = 0; (j < (doc + i)->value.rubriques.iNban9 && '0' == (doc + i)->value.rubriques.Tan9[j].dnex); j++)\n" \
12443  " ;\n" \
12444  "\n" \
12445  " if ((doc + i)->value.rubriques.iNban9 != j)\n" \
12446  " break;\n" \
12447  " }\n" \
12448  "\n" \
12449  " if ((-1 != iPJDC) && (iNb != i))\n" \
12450  " {\n" \
12451  " /* ajout du produit fictif de ranking PJDOC */\n" \
12452  " nb_micro = doc->value.objets_pub.nb_micro;\n" \
12453  " strcpy(doc->value.objets_pub.micro[nb_micro].type, \"X\");\n" \
12454  " strcpy(rIamicEtab.acNumobj, \"0001\");\n" \
12455  " strcat(rIamicEtab.acNumobj, apcEtab);\n" \
12456  " strcat(rIamicEtab.acNumobj, \"0001\");\n" \
12457  " date = time(NULL);\n" \
12458  " (void)strftime(rIamicEtab.acDatact, sizeof(rIamicEtab.acDatact), \"%Y%m%d\", localtime(&date));\n" \
12459  " strcpy(doc->value.objets_pub.micro[nb_micro].stype, giv_sRKPJDC);\n" \
12460  " strcpy(doc->value.objets_pub.micro[nb_micro].sstype, giv_sRKPJDC);\n" \
12461  " doc->value.objets_pub.micro[nb_micro].valeur[0] = '\\0';\n" \
12462  " strcpy(doc->value.objets_pub.micro[nb_micro].id, rIamicEtab.acNumobj);\n" \
12463  " strcpy(doc->value.objets_pub.micro[nb_micro].tcdatact, rIamicEtab.acDatact);\n" \
12464  " doc->value.objets_pub.micro[nb_micro].iCVI = 0;\n" \
12465  " doc->value.objets_pub.micro[nb_micro].stypcvi[0] = '\\0';\n" \
12466  " strcpy(doc->value.objets_pub.micro[nb_micro].stypint, doc->value.objets_pub.micro[nb_micro].stype);\n" \
12467  " nb_micro++;\n" \
12468  " doc->value.objets_pub.nb_micro = nb_micro;\n" \
12469  " }\n" \
12470  "\n" \
12471  " return (iCodRet);\n" \
12472  "}\n" \
12473  "\n" \
12474  "/*----------------------------------Fonction----------------------------------*\n" \
12475  " * Fonction : givLecturePhotosEtab\n" \
12476  " *\n" \
12477  " * But : champs des photos de l'établissement.\n" \
12478  " *\n" \
12479  " * Description : Lecture\n" \
12480  " * dans la table GYTtabPhotoEtab.\n" \
12481  " *\n" \
12482  " *\n" \
12483  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
12484  "\n" \
12485  "int4 givLecturePhotosEtab(GYBrDOCUMENTEpj* doc, char** buf_pos_in, int4* apiDeb)\n" \
12486  "{\n" \
12487  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
12488  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
12489  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
12490  " int1 indFinFetch; /* Indicateur de fin de balayage du curseur */\n" \
12491  " int4 lg_ecr;\n" \
12492  " char* buf_pos;\n" \
12493  " int4 iDeb;\n" \
12494  " EXEC SQL\n" \
12495  " begin declare\n" \
12496  " section;\n" \
12497  " GYBrPhotosEtabT rPhoto;\n" \
12498  " GYBrIndPhotosEtabT rIndPhoto;\n" \
12499  " OCIClobLocator* pClob;\n" \
12500  " int2 sIndI;\n" \
12501  " EXEC SQL\n" \
12502  " end declare\n" \
12503  " section;\n" \
12504  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
12505  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
12506  " (void)strcpy(rPhoto.acEtab, doc->value.a_classer.etab);\n" \
12507  " GWTTrace(GWT_NIV_FONCT, (\"Photos pour Etab: %s\\n\", rPhoto.acEtab));\n" \
12508  " lg_ecr = 0;\n" \
12509  " iDeb = 0;\n" \
12510  " GIVBuffInter[0] = '\\0';\n" \
12511  " /* Initialisation pointeur */\n" \
12512  " buf_pos = *buf_pos_in;\n" \
12513  " /* Traitement des erreurs SQL */\n" \
12514  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLecturePhotosEtab\");\n" \
12515  " EXEC SQL\n" \
12516  " OPEN crsLecturePhotosEtab\n" \
12517  " USING: rPhoto.acEtab;\n" \
12518  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12519  "\n" \
12520  " if ((int4)GIV::GYBok != iIntRet)\n" \
12521  " {\n" \
12522  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsLecturePhotosEtab: [COD=%d TXT=%s] -%s-\\n\", iIntRet, vErreurSQL.acDonnees_retour, rPhoto.acEtab));\n" \
12523  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12524  " }\n" \
12525  "\n" \
12526  " if ((int4)GIV::GYBok == iIntRet)\n" \
12527  " {\n" \
12528  " /* Execution requete de denombrement (FETCH du curseur) */\n" \
12529  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
12530  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Allocate de CLOB\");\n" \
12531  " EXEC SQL\n" \
12532  " ALLOCATE: pClob;\n" \
12533  " EXEC SQL\n" \
12534  " LOB CREATE\n" \
12535  " TEMPORARY: pClob;\n" \
12536  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12537  " GWTTrace(GWT_NIV_FONCT, (\"Allocation CLOB pour GYTtabPhotosEtab\\n\"));\n" \
12538  "\n" \
12539  " /* Analyse du code resultat SQL */\n" \
12540  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
12541  " {\n" \
12542  " EXEC SQL\n" \
12543  " close crsLecturePhotosEtab;\n" \
12544  " iCodRet = iIntRet;\n" \
12545  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : [COD=%d TXT=%s]\\n\", iCodRet, vErreurSQL.acOrdre_sql));\n" \
12546  " return (iCodRet);\n" \
12547  " }\n" \
12548  "\n" \
12549  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
12550  " {\n" \
12551  " EXEC SQL\n" \
12552  " FETCH crsLecturePhotosEtab\n" \
12553  " INTO\n" \
12554  " :rPhoto.acPhoto\n" \
12555  " :rIndPhoto.sPhotoI,\n" \
12556  " :rPhoto.acTitre:rIndPhoto.sTitreI,\n" \
12557  " :rPhoto.acCteUtil:rIndPhoto.sCteUtilI,\n" \
12558  " :rPhoto.acOri:rIndPhoto.sOriI,\n" \
12559  " :pClob:sIndI;\n" \
12560  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12561  " GWTTrace(GWT_NIV_FONCT, (\"Photos pour Etab: %d,%d\\n\", iIntRet, sIndI));\n" \
12562  "\n" \
12563  " if (1 == *apiDeb)\n" \
12564  " {\n" \
12565  " lg_ecr = giv_ecrit_noeud_simple(buf_pos, \"affugc\");\n" \
12566  " buf_pos = buf_pos + lg_ecr;\n" \
12567  " *apiDeb = 0;\n" \
12568  " }\n" \
12569  "\n" \
12570  " if (0 == iDeb)\n" \
12571  " {\n" \
12572  " if (((int4)GIV::GYBnodata == iIntRet) && ('1' != doc->value.a_classer.opphoto))\n" \
12573  " {\n" \
12574  " /* Etab sans photo et sans opposition photo : on n'écrit pas le bloc <ugcetab> */\n" \
12575  " break;\n" \
12576  " }\n" \
12577  "\n" \
12578  " strcpy(buf_pos, \"<ugcetab id=\\\"\");\n" \
12579  " strcat(buf_pos, doc->value.a_classer.etab);\n" \
12580  " strcat(buf_pos, \"\\\">\");\n" \
12581  " lg_ecr = strlen(buf_pos);\n" \
12582  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
12583  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
12584  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
12585  " lg_ecr = lg_ecr + 2;\n" \
12586  " buf_pos = (buf_pos + lg_ecr);\n" \
12587  " strcpy(buf_pos, \"<oppphotos>\");\n" \
12588  "\n" \
12589  " if ('1' == doc->value.a_classer.opphoto)\n" \
12590  " strcat(buf_pos, \"ugc\");\n" \
12591  "\n" \
12592  " strcat(buf_pos, \"</oppphotos>\");\n" \
12593  " lg_ecr = strlen(buf_pos);\n" \
12594  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
12595  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
12596  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
12597  " lg_ecr = lg_ecr + 2;\n" \
12598  " buf_pos = (buf_pos + lg_ecr);\n" \
12599  " lg_ecr = giv_ecrit_noeud_simple(buf_pos, \"ugcphotos\");\n" \
12600  " buf_pos = buf_pos + lg_ecr;\n" \
12601  " }\n" \
12602  "\n" \
12603  " if ((int4)GIV::GYBok == iIntRet)\n" \
12604  " {\n" \
12605  " lg_ecr = giv_ecrit_noeud_simple(buf_pos, \"photo\");\n" \
12606  " buf_pos = buf_pos + lg_ecr;\n" \
12607  "\n" \
12608  " if ((int4)GIV::GYBok != rIndPhoto.sPhotoI)\n" \
12609  " rPhoto.acPhoto[0] = '\\0';\n" \
12610  "\n" \
12611  " if ((int4)GIV::GYBok != rIndPhoto.sTitreI)\n" \
12612  " rPhoto.acTitre[0] = '\\0';\n" \
12613  "\n" \
12614  " if ((int4)GIV::GYBok != rIndPhoto.sCteUtilI)\n" \
12615  " rPhoto.acCteUtil[0] = '\\0';\n" \
12616  "\n" \
12617  " if ((int4)GIV::GYBok != rIndPhoto.sOriI)\n" \
12618  " rPhoto.acOri[0] = '\\0';\n" \
12619  "\n" \
12620  " rPhoto.acLongitude[0] = '\\0';\n" \
12621  " rPhoto.acLatitude[0] = '\\0';\n" \
12622  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
12623  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rPhoto.acPhoto, \"identifiantphoto\");\n" \
12624  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rPhoto.acTitre, \"legende\");\n" \
12625  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rPhoto.acOri, \"origine\");\n" \
12626  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rPhoto.acCteUtil, \"uid\");\n" \
12627  "\n" \
12628  " if ((int4)GIV::GYBok == sIndI)\n" \
12629  " {\n" \
12630  " EXEC SQL\n" \
12631  " LOB\n" \
12632  " OPEN :pClob READ\n" \
12633  " ONLY;\n" \
12634  " /* lecture des données xmltype */\n" \
12635  " givLectClob(pClob, doc->value.a_classer.etab, \"\", giv_PHO, giv_PHO);\n" \
12636  " /* conversion du XMLType */\n" \
12637  " (void)givConvClob();\n" \
12638  "\n" \
12639  " if (0 != strlen(GIVBuffInter))\n" \
12640  " {\n" \
12641  " strcpy(buf_pos, GIVBuffInter);\n" \
12642  " lg_ecr = strlen(buf_pos);\n" \
12643  " buf_pos = (buf_pos + lg_ecr);\n" \
12644  " }\n" \
12645  "\n" \
12646  " EXEC SQL\n" \
12647  " LOB\n" \
12648  " CLOSE: pClob;\n" \
12649  " }\n" \
12650  "\n" \
12651  " lg_ecr = giv_ecrit_fin_noeud(&buf_pos, \"photo\");\n" \
12652  " buf_pos = buf_pos + lg_ecr;\n" \
12653  " iDeb = 1;\n" \
12654  " }\n" \
12655  " else\n" \
12656  " {\n" \
12657  " /* fin de boucle */\n" \
12658  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
12659  " lg_ecr = giv_ecrit_fin_noeud(&buf_pos, \"ugcphotos\");\n" \
12660  " buf_pos = buf_pos + lg_ecr;\n" \
12661  " lg_ecr = giv_ecrit_fin_noeud(&buf_pos, \"ugcetab\");\n" \
12662  " buf_pos = buf_pos + lg_ecr;\n" \
12663  " iDeb = 1;\n" \
12664  " }\n" \
12665  " }\n" \
12666  "\n" \
12667  " EXEC SQL\n" \
12668  " close crsLecturePhotosEtab;\n" \
12669  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12670  "\n" \
12671  " if ((int4)GIV::GYBok != iIntRet)\n" \
12672  " {\n" \
12673  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLecturePhotosEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
12674  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12675  " }\n" \
12676  "\n" \
12677  " GWTTrace(GWT_NIV_FONCT, (\"Liberation CLOB pour GYTtabPhotosEtab\\n\"));\n" \
12678  " /* liberation CLOB */\n" \
12679  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Liberation de CLOB\");\n" \
12680  " EXEC SQL\n" \
12681  " LOB FREE\n" \
12682  " TEMPORARY: pClob;\n" \
12683  " EXEC SQL\n" \
12684  " FREE: pClob;\n" \
12685  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12686  "\n" \
12687  " /* Analyse du code resultat SQL */\n" \
12688  " if ((int4)GIV::GYBok != iIntRet)\n" \
12689  " {\n" \
12690  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acOrdre_sql));\n" \
12691  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur libération Clob PhotosEtab\\n\"));\n" \
12692  " }\n" \
12693  " }\n" \
12694  "\n" \
12695  " *buf_pos_in = buf_pos;\n" \
12696  " return (iCodRet);\n" \
12697  "}\n" \
12698  "\n" \
12699  "/*----------------------------------Fonction----------------------------------*\n" \
12700  " * Fonction : givExtractPartEtab\n" \
12701  " *\n" \
12702  " * But : champs du calendrier et des photos du partenaire.\n" \
12703  " *\n" \
12704  " * Description : extract\n" \
12705  " * dans la table GYTtabPartEtab.\n" \
12706  " *\n" \
12707  " *\n" \
12708  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
12709  "\n" \
12710  "int4 givExtractPartEtab(GYBrIapartT* aprPart, char** buf_pos_in, char* apcType)\n" \
12711  "{\n" \
12712  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
12713  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
12714  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
12715  " int1 indFinFetch; /* Indicateur de fin de balayage du curseur */\n" \
12716  " int4 lg_ecr;\n" \
12717  " char* buf_pos;\n" \
12718  " int4 iDeb;\n" \
12719  " int4 iLgBuffer;\n" \
12720  " int4 iLgRequete;\n" \
12721  " EXEC SQL\n" \
12722  " begin declare\n" \
12723  " section;\n" \
12724  " char cRequete[giv_LG_REQUETE * 4];\n" \
12725  " GYBrIapartT rPart;\n" \
12726  " static OCIClobLocator* pClob;\n" \
12727  " int2 sIndI;\n" \
12728  " EXEC SQL\n" \
12729  " end declare\n" \
12730  " section;\n" \
12731  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
12732  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
12733  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
12734  " (void)strcpy(rPart.acOriPart, aprPart->acOriPart);\n" \
12735  " (void)strcpy(rPart.acRefPart, aprPart->acRefPart);\n" \
12736  " lg_ecr = 0;\n" \
12737  " iDeb = 0;\n" \
12738  " GIVBuffInter[0] = '\\0';\n" \
12739  " /* Initialisation pointeur */\n" \
12740  " buf_pos = *buf_pos_in;\n" \
12741  " /* Execution requete de denombrement (FETCH du curseur) */\n" \
12742  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
12743  "\n" \
12744  " if ((int4)GIV::GWCCodeOK != iDejaPrepare)\n" \
12745  " {\n" \
12746  " /* Controle de la longueur du texte de la requete */\n" \
12747  " iLgRequete = strlen(GIV_RQ_SELECT_CALEND_PART);\n" \
12748  " iLgBuffer = sizeof(cRequete);\n" \
12749  " GWTTrace(GWT_NIV_FONCT, (\"Longueurs : (requete -> %d buffer -> %d)\\n\", iLgRequete, iLgBuffer));\n" \
12750  "\n" \
12751  " if (iLgBuffer <= iLgRequete)\n" \
12752  " {\n" \
12753  " /* Buffer locale trop petit pour la requete => probleme EVIDENT !!! */\n" \
12754  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12755  " }\n" \
12756  "\n" \
12757  " /* Construction du texte de la requete */\n" \
12758  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
12759  " {\n" \
12760  " (void)sprintf(cRequete,\n" \
12761  " GIV_RQ_SELECT_PHOTO_PART);\n" \
12762  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
12763  " /* Controle et parsing de la requete SQL */\n" \
12764  " EXEC SQL\n" \
12765  " prepare rqtLecturePhotoPart\n" \
12766  " from: cRequete;\n" \
12767  " /* Traitement des erreurs SQL */\n" \
12768  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLecturePhotoPart\");\n" \
12769  " iIntRet = GYBErreur(&vErreurSQL);\n" \
12770  "\n" \
12771  " if ((int4)GIV::GYBok != iIntRet)\n" \
12772  " {\n" \
12773  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLecturePhotoPart : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
12774  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12775  " }\n" \
12776  " else\n" \
12777  " {\n" \
12778  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
12779  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLecturePhotoPart\");\n" \
12780  " EXEC SQL\n" \
12781  " declare crsLecturePhotoPart\n" \
12782  " cursor\n" \
12783  " for rqtLecturePhotoPart;\n" \
12784  " iIntRet = GYBErreur(&vErreurSQL);\n" \
12785  "\n" \
12786  " if ((int4)GIV::GYBok != iIntRet)\n" \
12787  " {\n" \
12788  " /* Erreur sur declaration curseur SQL */\n" \
12789  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLecturePhotoPart ...\\n\"));\n" \
12790  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12791  " }\n" \
12792  " }\n" \
12793  "\n" \
12794  " (void)sprintf(cRequete,\n" \
12795  " GIV_RQ_SELECT_CALEND_PART);\n" \
12796  " GWTTrace(GWT_NIV_FONCT, (\"Requetee SQL : %s\\n\", cRequete));\n" \
12797  " /* Controle et parsing de la requete SQL */\n" \
12798  " EXEC SQL\n" \
12799  " prepare rqtLectureCalendPart\n" \
12800  " from: cRequete;\n" \
12801  " /* Traitement des erreurs SQL */\n" \
12802  " (void)strcpy(vErreurSQL.acOrdre_sql, \"prepare rqtLectureCalendPart\");\n" \
12803  " iIntRet = GYBErreur(&vErreurSQL);\n" \
12804  "\n" \
12805  " if ((int4)GIV::GYBok != iIntRet)\n" \
12806  " {\n" \
12807  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur prepare rqtLectureCalendPart : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
12808  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12809  " }\n" \
12810  " else\n" \
12811  " {\n" \
12812  " /* Declaration curseur SQL (car requete type SELECT) */\n" \
12813  " (void)strcpy(vErreurSQL.acOrdre_sql, \"declare crsLectureCalendPart\");\n" \
12814  " EXEC SQL\n" \
12815  " declare crsLectureCalendPart\n" \
12816  " cursor\n" \
12817  " for rqtLectureCalendPart;\n" \
12818  " iIntRet = GYBErreur(&vErreurSQL);\n" \
12819  "\n" \
12820  " if ((int4)GIV::GYBok != iIntRet)\n" \
12821  " {\n" \
12822  " /* Erreur sur declaration curseur SQL */\n" \
12823  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur DECLARE crsLectureCalendPart ...\\n\"));\n" \
12824  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12825  " }\n" \
12826  " }\n" \
12827  " }\n" \
12828  "\n" \
12829  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Allocate de CLOB\");\n" \
12830  " EXEC SQL\n" \
12831  " ALLOCATE: pClob;\n" \
12832  " EXEC SQL\n" \
12833  " LOB CREATE\n" \
12834  " TEMPORARY: pClob;\n" \
12835  " /* EXEC SQL LOB OPEN :pClob READ ONLY; */\n" \
12836  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12837  " GWTTrace(GWT_NIV_FONCT, (\"Allocation CLOB pour GYTtabPhotoPart\\n\"));\n" \
12838  "\n" \
12839  " /* Analyse du code resultat SQL */\n" \
12840  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
12841  " {\n" \
12842  " iCodRet = iIntRet;\n" \
12843  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : [COD=%d TXT=%s]\\n\", iCodRet, vErreurSQL.acOrdre_sql));\n" \
12844  " return (iCodRet);\n" \
12845  " }\n" \
12846  "\n" \
12847  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
12848  " }\n" \
12849  "\n" \
12850  " /* Traitement des erreurs SQL */\n" \
12851  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLecturePhotoPart\");\n" \
12852  " GWTTrace(GWT_NIV_FONCT, (\"Appel PhotoPart: %s,%s\\n\", rPart.acOriPart, rPart.acRefPart));\n" \
12853  "\n" \
12854  " if (0 == strcmp(giv_PHO, apcType))\n" \
12855  " {\n" \
12856  " EXEC SQL\n" \
12857  " OPEN crsLecturePhotoPart\n" \
12858  " USING :rPart.acOriPart,\n" \
12859  " :rPart.acRefPart;\n" \
12860  " }\n" \
12861  " else\n" \
12862  " {\n" \
12863  " EXEC SQL\n" \
12864  " OPEN crsLectureCalendPart\n" \
12865  " USING :rPart.acOriPart,\n" \
12866  " :rPart.acRefPart;\n" \
12867  " }\n" \
12868  "\n" \
12869  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12870  "\n" \
12871  " if ((int4)GIV::GYBok != iIntRet)\n" \
12872  " {\n" \
12873  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsLecturePhotoPart: [COD=%d TXT=%s] -%s-\\n\", iIntRet, vErreurSQL.acDonnees_retour, rPart.acRefPart));\n" \
12874  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12875  " }\n" \
12876  "\n" \
12877  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
12878  " {\n" \
12879  " if (0 == strcmp(giv_PHO, apcType))\n" \
12880  " {\n" \
12881  " EXEC SQL\n" \
12882  " FETCH crsLecturePhotoPart\n" \
12883  " INTO: pClob: sIndI;\n" \
12884  " }\n" \
12885  " else\n" \
12886  " {\n" \
12887  " EXEC SQL\n" \
12888  " FETCH crsLectureCalendPart\n" \
12889  " INTO: pClob: sIndI;\n" \
12890  " }\n" \
12891  "\n" \
12892  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12893  "\n" \
12894  " if ((int4)GIV::GYBok == iIntRet)\n" \
12895  " {\n" \
12896  " if ((int4)GIV::GYBok == sIndI)\n" \
12897  " {\n" \
12898  " /* lecture des données xmltype */\n" \
12899  " givLectClob(pClob, \"\", aprPart->acRefPart, apcType, apcType);\n" \
12900  " /* conversion du XMLType */\n" \
12901  " (void)givConvClob();\n" \
12902  "\n" \
12903  " if (0 != strlen(GIVBuffInter))\n" \
12904  " {\n" \
12905  " strcpy(buf_pos, GIVBuffInter);\n" \
12906  " lg_ecr = strlen(buf_pos);\n" \
12907  " buf_pos = (buf_pos + lg_ecr);\n" \
12908  " }\n" \
12909  " }\n" \
12910  "\n" \
12911  " /* fin de boucle */\n" \
12912  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
12913  " }\n" \
12914  " else\n" \
12915  " {\n" \
12916  " /* fin de boucle */\n" \
12917  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
12918  " }\n" \
12919  " }\n" \
12920  "\n" \
12921  " if (0 == strcmp(giv_PHO, apcType))\n" \
12922  " {\n" \
12923  " EXEC SQL\n" \
12924  " close crsLecturePhotoPart;\n" \
12925  " }\n" \
12926  " else\n" \
12927  " {\n" \
12928  " EXEC SQL\n" \
12929  " close crsLectureCalendPart;\n" \
12930  " }\n" \
12931  "\n" \
12932  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12933  "\n" \
12934  " if ((int4)GIV::GYBok != iIntRet)\n" \
12935  " {\n" \
12936  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLecturePhotoPart: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
12937  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12938  " }\n" \
12939  "\n" \
12940  " *buf_pos_in = buf_pos;\n" \
12941  " return (iCodRet);\n" \
12942  "}\n" \
12943  "\n" \
12944  "/*----------------------------------Fonction----------------------------------*\n" \
12945  " * Fonction : givLectureLvsSeoEtab\n" \
12946  " *\n" \
12947  " * But : champs des liens vers les sites issus de SEO.\n" \
12948  " *\n" \
12949  " * Description : Lecture\n" \
12950  " * dans la table GYTtabLvsSeoEtab.\n" \
12951  " *\n" \
12952  " *\n" \
12953  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
12954  "\n" \
12955  "int4 givLectureLvsSeoEtab(GYBrDOCUMENTEpj* doc, char** buf_pos_in, int4* apiDeb)\n" \
12956  "{\n" \
12957  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
12958  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
12959  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
12960  " int1 indFinFetch; /* Indicateur de fin de balayage du curseur */\n" \
12961  " int4 lg_ecr;\n" \
12962  " char* buf_pos;\n" \
12963  " int4 iDeb;\n" \
12964  " EXEC SQL\n" \
12965  " begin declare\n" \
12966  " section;\n" \
12967  " GYBrLvsSeoEtabT rLvs;\n" \
12968  " GYBrIndLvsSeoEtabT rIndLvs;\n" \
12969  " EXEC SQL\n" \
12970  " end declare\n" \
12971  " section;\n" \
12972  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
12973  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
12974  " (void)strcpy(rLvs.acEtab, doc->value.a_classer.etab);\n" \
12975  " lg_ecr = 0;\n" \
12976  " iDeb = 0;\n" \
12977  " /* Initialisation pointeur */\n" \
12978  " buf_pos = *buf_pos_in;\n" \
12979  " /* Traitement des erreurs SQL */\n" \
12980  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureLvsSeoEtab\");\n" \
12981  " EXEC SQL\n" \
12982  " OPEN crsLectureLvsSeoEtab\n" \
12983  " USING: rLvs.acEtab;\n" \
12984  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
12985  "\n" \
12986  " if ((int4)GIV::GYBok != iIntRet)\n" \
12987  " {\n" \
12988  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsLectureLvsSeoEtab: [COD=%d TXT=%s] -%s-\\n\", iIntRet, vErreurSQL.acDonnees_retour, rLvs.acEtab));\n" \
12989  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
12990  " }\n" \
12991  "\n" \
12992  " if ((int4)GIV::GYBok == iIntRet)\n" \
12993  " {\n" \
12994  " /* Execution requete de denombrement (FETCH du curseur) */\n" \
12995  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
12996  "\n" \
12997  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
12998  " {\n" \
12999  " EXEC SQL\n" \
13000  " FETCH crsLectureLvsSeoEtab\n" \
13001  " INTO\n" \
13002  " :rLvs.acIdstat\n" \
13003  " :rIndLvs.sIdstatI,\n" \
13004  " :rLvs.acPartseo:rIndLvs.sPartseoI,\n" \
13005  " :rLvs.acUrlseo:rIndLvs.sUrlseoI,\n" \
13006  " :rLvs.acAncre:rIndLvs.sAncreI,\n" \
13007  " :rLvs.acFollow:rIndLvs.sFollowI,\n" \
13008  " :rLvs.acOrdre:rIndLvs.sOrdreI;\n" \
13009  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13010  "\n" \
13011  " if ((int4)GIV::GYBok == iIntRet)\n" \
13012  " {\n" \
13013  " if (1 == *apiDeb)\n" \
13014  " {\n" \
13015  " lg_ecr = giv_ecrit_noeud_simple(buf_pos, \"lvsparts\");\n" \
13016  " buf_pos = buf_pos + lg_ecr;\n" \
13017  " *apiDeb = 0;\n" \
13018  " }\n" \
13019  "\n" \
13020  " strcpy(buf_pos, \"<lvspart etab=\\\"\");\n" \
13021  " strcat(buf_pos, doc->value.a_classer.etab);\n" \
13022  " strcat(buf_pos, \"\\\">\");\n" \
13023  " lg_ecr = strlen(buf_pos);\n" \
13024  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
13025  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
13026  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
13027  " lg_ecr = lg_ecr + 2;\n" \
13028  " buf_pos = (buf_pos + lg_ecr);\n" \
13029  "\n" \
13030  " if ((int4)GIV::GYBok != rIndLvs.sIdstatI)\n" \
13031  " rLvs.acIdstat[0] = '\\0';\n" \
13032  "\n" \
13033  " if ((int4)GIV::GYBok != rIndLvs.sPartseoI)\n" \
13034  " rLvs.acPartseo[0] = '\\0';\n" \
13035  "\n" \
13036  " if ((int4)GIV::GYBok != rIndLvs.sUrlseoI)\n" \
13037  " rLvs.acUrlseo[0] = '\\0';\n" \
13038  "\n" \
13039  " if ((int4)GIV::GYBok != rIndLvs.sAncreI)\n" \
13040  " rLvs.acAncre[0] = '\\0';\n" \
13041  "\n" \
13042  " if ((int4)GIV::GYBok != rIndLvs.sFollowI)\n" \
13043  " rLvs.acFollow[0] = '\\0';\n" \
13044  "\n" \
13045  " if ((int4)GIV::GYBok != rIndLvs.sOrdreI)\n" \
13046  " rLvs.acOrdre[0] = '\\0';\n" \
13047  "\n" \
13048  " lg_ecr = giv_ecrit_balise(buf_pos, rLvs.acIdstat, \"idstat\");\n" \
13049  " buf_pos = buf_pos + lg_ecr;\n" \
13050  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
13051  "\n" \
13052  " if ((int4)GIV::GYBok == rIndLvs.sPartseoI)\n" \
13053  " lg_ecr = giv_ecrit_balise_epj(&buf_pos, rLvs.acPartseo, \"partenaire\");\n" \
13054  "\n" \
13055  " if ((int4)GIV::GYBok == rIndLvs.sUrlseoI)\n" \
13056  " {\n" \
13057  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
13058  " (void)strcpy(GIVBuffInter, rLvs.acUrlseo);\n" \
13059  " (void)givConvClob();\n" \
13060  " (void)strcpy(buf_concat, \"<![CDATA[\");\n" \
13061  " (void)strcat(buf_concat, GIVBuffInter);\n" \
13062  " (void)strcat(buf_concat, \"]]>\");\n" \
13063  " GWTTrace(GWT_NIV_FONCT, (\"URL DATA: %s\\n\", buf_concat));\n" \
13064  " lg_ecr = giv_ecrit_balise(buf_pos, buf_concat, \"url\");\n" \
13065  " buf_pos = buf_pos + lg_ecr;\n" \
13066  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
13067  " }\n" \
13068  "\n" \
13069  " if ((int4)GIV::GYBok == rIndLvs.sAncreI)\n" \
13070  " {\n" \
13071  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
13072  " (void)strcpy(GIVBuffInter, rLvs.acAncre);\n" \
13073  " (void)givConvClob();\n" \
13074  " (void)strcpy(buf_concat, \"<![CDATA[\");\n" \
13075  " (void)strcat(buf_concat, GIVBuffInter);\n" \
13076  " (void)strcat(buf_concat, \"]]>\");\n" \
13077  " GWTTrace(GWT_NIV_FONCT, (\"ANCRE DATA: %s\\n\", buf_concat));\n" \
13078  " lg_ecr = giv_ecrit_balise(buf_pos, buf_concat, \"ancre\");\n" \
13079  " buf_pos = buf_pos + lg_ecr;\n" \
13080  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
13081  " }\n" \
13082  "\n" \
13083  " lg_ecr = giv_ecrit_balise(buf_pos, rLvs.acFollow, \"follow\");\n" \
13084  " buf_pos = buf_pos + lg_ecr;\n" \
13085  " lg_ecr = giv_ecrit_balise(buf_pos, rLvs.acOrdre, \"ordre\");\n" \
13086  " buf_pos = buf_pos + lg_ecr;\n" \
13087  " lg_ecr = giv_ecrit_fin_noeud(&buf_pos, \"lvspart\");\n" \
13088  " buf_pos = buf_pos + lg_ecr;\n" \
13089  " }\n" \
13090  " else\n" \
13091  " {\n" \
13092  " /* fin de boucle */\n" \
13093  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
13094  " }\n" \
13095  " }\n" \
13096  "\n" \
13097  " EXEC SQL\n" \
13098  " close crsLectureLvsSeoEtab;\n" \
13099  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13100  "\n" \
13101  " if ((int4)GIV::GYBok != iIntRet)\n" \
13102  " {\n" \
13103  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureLvsSeoEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
13104  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
13105  " }\n" \
13106  "\n" \
13107  " /* ecriture */\n" \
13108  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
13109  " }\n" \
13110  "\n" \
13111  " *buf_pos_in = buf_pos;\n" \
13112  " return (iCodRet);\n" \
13113  "}\n" \
13114  "\n" \
13115  "/*----------------------------------Fonction----------------------------------*\n" \
13116  " * Fonction : givLectureLiensEtab\n" \
13117  " *\n" \
13118  " * But : champs des liens par epj.\n" \
13119  " *\n" \
13120  " * Description : Lecture\n" \
13121  " * dans la table GYTtabLvsEtab.\n" \
13122  " *\n" \
13123  " *\n" \
13124  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
13125  "\n" \
13126  "int4 givLectureLiensEtab(GYBrDOCUMENTEpj* doc, char** buf_pos_in, int4* apiDeb, int4 iNb)\n" \
13127  "{\n" \
13128  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
13129  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
13130  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
13131  " int1 indFinFetch; /* Indicateur de fin de balayage du curseur */\n" \
13132  " int4 lg_ecr;\n" \
13133  " char* buf_pos;\n" \
13134  " int4 iDeb, iRef;\n" \
13135  " GYBrIapartT rIapart;\n" \
13136  " int4 i, k, kk, x;\n" \
13137  " int4 iRang, iObj;\n" \
13138  " EXEC SQL\n" \
13139  " begin declare\n" \
13140  " section;\n" \
13141  " GYBrLienEtabT rLien;\n" \
13142  " GYBrIndLienEtabT rIndLien;\n" \
13143  " EXEC SQL\n" \
13144  " end declare\n" \
13145  " section;\n" \
13146  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
13147  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
13148  " (void)strcpy(rLien.acEtab, doc->value.a_classer.etab);\n" \
13149  " lg_ecr = 0;\n" \
13150  " iDeb = 0;\n" \
13151  " /* Initialisation pointeur */\n" \
13152  " buf_pos = *buf_pos_in;\n" \
13153  " /* Traitement des erreurs SQL */\n" \
13154  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureLiensEtab\");\n" \
13155  " EXEC SQL\n" \
13156  " OPEN crsLectureLiensEtab\n" \
13157  " USING: rLien.acEtab;\n" \
13158  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13159  "\n" \
13160  " if ((int4)GIV::GYBok != iIntRet)\n" \
13161  " {\n" \
13162  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur open crsLectureLiensEtab: [COD=%d TXT=%s] -%s-\\n\", iIntRet, vErreurSQL.acDonnees_retour, rLien.acEtab));\n" \
13163  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
13164  " }\n" \
13165  "\n" \
13166  " if ((int4)GIV::GYBok == iIntRet)\n" \
13167  " {\n" \
13168  " /* Execution requete de denombrement (FETCH du curseur) */\n" \
13169  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
13170  "\n" \
13171  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
13172  " {\n" \
13173  " EXEC SQL\n" \
13174  " FETCH crsLectureLiensEtab\n" \
13175  " INTO\n" \
13176  " :rLien.acTpdsob,\n" \
13177  " :rLien.acStobj,\n" \
13178  " :rLien.acNumobj,\n" \
13179  " :rLien.acCle:rIndLien.sCleI,\n" \
13180  " :rLien.acValeur:rIndLien.sValeurI;\n" \
13181  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13182  "\n" \
13183  " if ((int4)GIV::GYBok == iIntRet)\n" \
13184  " {\n" \
13185  " if ((0 == strcmp(rLien.acTpdsob, giv_sCHRO)) && (0 == strcmp(rLien.acStobj, giv_ssCHRO)) && (NULL == strstr(givtcFourPart, giv_CHRO)))\n" \
13186  " {\n" \
13187  " for (x = 0; x < iNb; x++)\n" \
13188  " {\n" \
13189  " for (i = 0; i < (doc + x)->value.a_classer.iNbPart; i++)\n" \
13190  " {\n" \
13191  " /* ajout de LC-CH si partenaire CHRONORESTO */\n" \
13192  " iRef = strlen((doc + x)->value.a_classer.trpart[i].rpart);\n" \
13193  " (void)strcpy(rIapart.acOriPart, &(doc + x)->value.a_classer.trpart[i].rpart[iRef - 4]);\n" \
13194  "\n" \
13195  " if (0 == strcmp(rIapart.acOriPart, giv_CHRO))\n" \
13196  " break;\n" \
13197  " }\n" \
13198  "\n" \
13199  " if ((doc + x)->value.a_classer.iNbPart != i)\n" \
13200  " break;\n" \
13201  " }\n" \
13202  "\n" \
13203  " if (iNb == x)\n" \
13204  " {\n" \
13205  " /* LC-CH non remplacé par le partenaire CHRONORESTO */\n" \
13206  " continue;\n" \
13207  " }\n" \
13208  " }\n" \
13209  "\n" \
13210  " if (1 == *apiDeb)\n" \
13211  " {\n" \
13212  " lg_ecr = giv_ecrit_noeud_simple(buf_pos, \"elementsproduits\");\n" \
13213  " buf_pos = buf_pos + lg_ecr;\n" \
13214  " *apiDeb = 0;\n" \
13215  " }\n" \
13216  "\n" \
13217  " if ((int4)GIV::GYBok != rIndLien.sCleI)\n" \
13218  " rLien.acCle[0] = '\\0';\n" \
13219  "\n" \
13220  " buf_concat[0] = '\\0';\n" \
13221  "\n" \
13222  " if ((int4)GIV::GYBok != rIndLien.sValeurI)\n" \
13223  " rLien.acValeur[0] = '\\0';\n" \
13224  " else\n" \
13225  " givConvURL(rLien.acValeur);\n" \
13226  "\n" \
13227  " iRang = -1;\n" \
13228  "\n" \
13229  " for (i = 0; i < givrListObj.iNbr; i++)\n" \
13230  " {\n" \
13231  " k = givrListObj.trEltRangListObj[i];\n" \
13232  " kk = givrListObj.trEltListObj[k].iRgLigne;\n" \
13233  " iObj = givrListObj.trEltListObj[k].iRgObj;\n" \
13234  "\n" \
13235  " if (iRang != givrListObj.trEltListObj[k].iRangTri)\n" \
13236  " {\n" \
13237  " iRang = givrListObj.trEltListObj[k].iRangTri;\n" \
13238  "\n" \
13239  " if (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, rLien.acTpdsob) && 0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, rLien.acStobj)\n" \
13240  " && 0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].id, rLien.acNumobj))\n" \
13241  " {\n" \
13242  " if ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, giv_sPJDC)) && (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, giv_ssPJDC))\n" \
13243  " && (0 != strlen((doc + kk)->value.objets_pub.micro[iObj].valeur)))\n" \
13244  " {\n" \
13245  " /* si LP-CR pour PJDC */\n" \
13246  " /* garder valeur du partenaire */\n" \
13247  " }\n" \
13248  " else\n" \
13249  " {\n" \
13250  " strcpy((doc + kk)->value.objets_pub.micro[iObj].valeur, buf_concat);\n" \
13251  " break;\n" \
13252  " }\n" \
13253  " }\n" \
13254  " }\n" \
13255  " }\n" \
13256  "\n" \
13257  " strcpy(buf_pos, \"<reference id=\\\"\");\n" \
13258  " strcat(buf_pos, rLien.acNumobj);\n" \
13259  " strcat(buf_pos, \"\\\" pjproduits=\\\"X\");\n" \
13260  " strcat(buf_pos, rLien.acTpdsob);\n" \
13261  " strcat(buf_pos, rLien.acStobj);\n" \
13262  " strcat(buf_pos, \"\\\">\");\n" \
13263  " lg_ecr = strlen(buf_pos);\n" \
13264  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
13265  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
13266  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
13267  " lg_ecr = lg_ecr + 2;\n" \
13268  " buf_pos = (buf_pos + lg_ecr);\n" \
13269  " strcpy(buf_pos, \"<clevaleur cle=\\\"\");\n" \
13270  " strcat(buf_pos, rLien.acCle);\n" \
13271  " strcat(buf_pos, \"\\\">\");\n" \
13272  " strcat(buf_pos, buf_concat);\n" \
13273  " strcat(buf_pos, \"</clevaleur>\");\n" \
13274  " lg_ecr = strlen(buf_pos);\n" \
13275  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
13276  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
13277  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
13278  " lg_ecr = lg_ecr + 2;\n" \
13279  " buf_pos = (buf_pos + lg_ecr);\n" \
13280  " lg_ecr = giv_ecrit_fin_noeud(&buf_pos, \"reference\");\n" \
13281  " buf_pos = buf_pos + lg_ecr;\n" \
13282  " }\n" \
13283  " else\n" \
13284  " {\n" \
13285  " /* fin de boucle */\n" \
13286  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
13287  " }\n" \
13288  " }\n" \
13289  "\n" \
13290  " EXEC SQL\n" \
13291  " close crsLectureLiensEtab;\n" \
13292  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13293  "\n" \
13294  " if ((int4)GIV::GYBok != iIntRet)\n" \
13295  " {\n" \
13296  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureLiensEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
13297  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
13298  " }\n" \
13299  "\n" \
13300  " /* ecriture */\n" \
13301  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
13302  " }\n" \
13303  "\n" \
13304  " *buf_pos_in = buf_pos;\n" \
13305  " return (iCodRet);\n" \
13306  "}\n" \
13307  "\n" \
13308  "/*----------------------------------Fonction----------------------------------*\n" \
13309  " * Fonction : givLectureObjetsGCpt\n" \
13310  " *\n" \
13311  " * But : champs des objets pub d'un établissement Grand Compte\n" \
13312  " *\n" \
13313  " * Description : Lecture\n" \
13314  " * dans la table GYTtabURLGCpt.\n" \
13315  " *\n" \
13316  " *\n" \
13317  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
13318  "\n" \
13319  "int4 givLectureObjetsGCpt(char* apcEtab, GYBrDOCUMENTEpj* doc, int4 aiIndic)\n" \
13320  "{\n" \
13321  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
13322  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
13323  " int4 i, j;\n" \
13324  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
13325  " EXEC SQL\n" \
13326  " begin declare\n" \
13327  " section;\n" \
13328  " char* pcOraEtab;\n" \
13329  " GYBrIamicT rIamicEtab;\n" \
13330  " GYBrIndIamicT rIndIamic;\n" \
13331  " EXEC SQL\n" \
13332  " VAR pcOraEtab\n" \
13333  " IS STRING;\n" \
13334  " EXEC SQL\n" \
13335  " end declare\n" \
13336  " section;\n" \
13337  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
13338  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
13339  " pcOraEtab = apcEtab;\n" \
13340  " /* Traitement des erreurs SQL */\n" \
13341  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLecturePubGCpt\");\n" \
13342  " EXEC SQL\n" \
13343  " OPEN crsLecturePubGCpt\n" \
13344  " USING: pcOraEtab;\n" \
13345  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13346  "\n" \
13347  " if ((int4)GIV::GYBok != iIntRet)\n" \
13348  " {\n" \
13349  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLecturePubGCpt: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
13350  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
13351  " }\n" \
13352  "\n" \
13353  " EXEC SQL\n" \
13354  " FETCH crsLecturePubGCpt\n" \
13355  " INTO\n" \
13356  " :rIamicEtab.acLibUrl\n" \
13357  " :rIndIamic.sLibUrlI;\n" \
13358  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13359  "\n" \
13360  " if ((int4)GIV::GYBok == iIntRet)\n" \
13361  " {\n" \
13362  " /* URL Grand Compte */\n" \
13363  " GWTTrace(GWT_NIV_FONCT, (\"URL Grand Compte: %s, %s\\n\", apcEtab, rIamicEtab.acLibUrl));\n" \
13364  " strcpy(doc->value.objets_pub.libUrlGCpt, rIamicEtab.acLibUrl);\n" \
13365  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
13366  " iIntRet = (int4)GIV::GIXCodeKO;\n" \
13367  "\n" \
13368  " for (i = 0; i < aiIndic; i++)\n" \
13369  " {\n" \
13370  " for (j = 0; j < (doc + i)->value.objets_pub.nb_micro; j++)\n" \
13371  " {\n" \
13372  " if (((doc + i)->value.objets_pub.micro[j].type[0] == 'X') && (0 == strcmp((doc + i)->value.objets_pub.micro[j].stype, \" U\")) && ((0 == strcmp((doc + i)->value.objets_pub.micro[j].sstype, \"PV\"))\n" \
13373  " || (0 == strcmp((doc + i)->value.objets_pub.micro[j].sstype, \"FS\"))))\n" \
13374  " {\n" \
13375  " /* toujours objet U/PV */\n" \
13376  " strcpy((doc + i)->value.objets_pub.micro[j].sstype, \"PV\");\n" \
13377  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
13378  " }\n" \
13379  " }\n" \
13380  " }\n" \
13381  "\n" \
13382  " if ((int4)GIV::GIXCodeOK != iIntRet)\n" \
13383  " {\n" \
13384  " /* ajout objet U/PV */\n" \
13385  " nb_micro = doc->value.objets_pub.nb_micro;\n" \
13386  " strcpy(doc->value.objets_pub.micro[nb_micro].type, \"X\");\n" \
13387  " strcpy(doc->value.objets_pub.micro[nb_micro].stype, \" U\");\n" \
13388  " strcpy(doc->value.objets_pub.micro[nb_micro].sstype, \"PV\");\n" \
13389  " strcpy(doc->value.objets_pub.micro[nb_micro].id, \"0001\");\n" \
13390  " strcat(doc->value.objets_pub.micro[nb_micro].id, apcEtab);\n" \
13391  " strcat(doc->value.objets_pub.micro[nb_micro].id, \"0001\");\n" \
13392  " doc->value.objets_pub.micro[nb_micro].iCVI = 0;\n" \
13393  " doc->value.objets_pub.micro[nb_micro].stypcvi[0] = '\\0';\n" \
13394  " strcpy(doc->value.objets_pub.micro[nb_micro].stypint, \" U\");\n" \
13395  " GWTTrace(GWT_NIV_FONCT, (\"Objet U/PV : %s\\n\", doc->value.objets_pub.micro[nb_micro].id));\n" \
13396  " nb_micro++;\n" \
13397  " doc->value.objets_pub.nb_micro = nb_micro;\n" \
13398  " }\n" \
13399  "\n" \
13400  " iIntRet = (int4)GIV::GIXCodeKO;\n" \
13401  "\n" \
13402  " for (i = 0; i < aiIndic; i++)\n" \
13403  " {\n" \
13404  " for (j = 0; j < (doc + i)->value.objets_pub.nb_micro; j++)\n" \
13405  " {\n" \
13406  " if (((doc + i)->value.objets_pub.micro[j].type[0] == 'X') && (0 == strcmp((doc + i)->value.objets_pub.micro[j].stype, \" U\")) && (0 == strcmp((doc + i)->value.objets_pub.micro[j].sstype, \"SR\")))\n" \
13407  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
13408  " }\n" \
13409  " }\n" \
13410  "\n" \
13411  " if ((int4)GIV::GIXCodeOK != iIntRet)\n" \
13412  " {\n" \
13413  " /* ajout objet U/SR */\n" \
13414  " nb_micro = doc->value.objets_pub.nb_micro;\n" \
13415  " strcpy(doc->value.objets_pub.micro[nb_micro].type, \"X\");\n" \
13416  " strcpy(doc->value.objets_pub.micro[nb_micro].stype, \" U\");\n" \
13417  " strcpy(doc->value.objets_pub.micro[nb_micro].sstype, \"SR\");\n" \
13418  " strcpy(doc->value.objets_pub.micro[nb_micro].id, \"0001\");\n" \
13419  " strcat(doc->value.objets_pub.micro[nb_micro].id, apcEtab);\n" \
13420  " strcat(doc->value.objets_pub.micro[nb_micro].id, \"0001\");\n" \
13421  " doc->value.objets_pub.micro[nb_micro].iCVI = 0;\n" \
13422  " doc->value.objets_pub.micro[nb_micro].stypcvi[0] = '\\0';\n" \
13423  " strcpy(doc->value.objets_pub.micro[nb_micro].stypint, \" U\");\n" \
13424  " GWTTrace(GWT_NIV_FONCT, (\"Objet U/PV : %s\\n\", doc->value.objets_pub.micro[nb_micro].id));\n" \
13425  " nb_micro++;\n" \
13426  " doc->value.objets_pub.nb_micro = nb_micro;\n" \
13427  " }\n" \
13428  " }\n" \
13429  "\n" \
13430  " EXEC SQL\n" \
13431  " close crsLecturePubGCpt;\n" \
13432  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13433  "\n" \
13434  " if ((int4)GIV::GYBok != iIntRet)\n" \
13435  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLecturePubGCpt: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
13436  "\n" \
13437  " return (iCodRet);\n" \
13438  "}\n" \
13439  "\n" \
13440  "/*----------------------------------Fonction----------------------------------*\n" \
13441  " * Fonction : givLectureTypeContEtab\n" \
13442  " *\n" \
13443  " * But : champs des types de contenu d'un epj\n" \
13444  " *\n" \
13445  " * Description : Lecture\n" \
13446  " * dans la table GYTtabContenusEtab.\n" \
13447  " *\n" \
13448  " *\n" \
13449  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
13450  "\n" \
13451  "int4 givLectureTypeContEtab(char* apcEtab)\n" \
13452  "{\n" \
13453  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
13454  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
13455  " int4 i;\n" \
13456  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
13457  " EXEC SQL\n" \
13458  " begin declare\n" \
13459  " section;\n" \
13460  " char* pcOraEtab;\n" \
13461  " GYBrIamicT rObjEtab;\n" \
13462  " GYBrIndIamicT rIndObj;\n" \
13463  " EXEC SQL\n" \
13464  " VAR pcOraEtab\n" \
13465  " IS STRING;\n" \
13466  " EXEC SQL\n" \
13467  " end declare\n" \
13468  " section;\n" \
13469  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
13470  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
13471  " pcOraEtab = apcEtab;\n" \
13472  " /* Traitement des erreurs SQL */\n" \
13473  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureTypContEtab\");\n" \
13474  " EXEC SQL\n" \
13475  " OPEN crsLectureTypContEtab\n" \
13476  " USING: pcOraEtab;\n" \
13477  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13478  "\n" \
13479  " if ((int4)GIV::GYBok != iIntRet)\n" \
13480  " {\n" \
13481  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureTypContEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
13482  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
13483  " }\n" \
13484  "\n" \
13485  " while ((int4)GIV::GYBok == iIntRet)\n" \
13486  " {\n" \
13487  " EXEC SQL\n" \
13488  " FETCH crsLectureTypContEtab\n" \
13489  " INTO\n" \
13490  " :rObjEtab.acTpdsob\n" \
13491  " :rIndObj.sTpdsobI,:rObjEtab.acTypobj:rIndObj.sTypobjI;\n" \
13492  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13493  "\n" \
13494  " if ((int4)GIV::GYBok == iIntRet)\n" \
13495  " {\n" \
13496  " if (MAX_LIST_CONT == giviNbContEtab)\n" \
13497  " {\n" \
13498  " GWTTrace(GWT_NIV_GRAVE, (\"Nombre de type de contenus des epj atteint %d\\n\", giviNbContEtab));\n" \
13499  " break;\n" \
13500  " }\n" \
13501  "\n" \
13502  " strcpy(givrListContEtab[giviNbContEtab].tcEtab, pcOraEtab);\n" \
13503  " strcpy(givrListContEtab[giviNbContEtab].tcType, rObjEtab.acTpdsob);\n" \
13504  "\n" \
13505  " if ((int4)GIV::GYBok != rIndObj.sTypobjI)\n" \
13506  " strcpy(givrListContEtab[giviNbContEtab].tcThm, \"\");\n" \
13507  " else\n" \
13508  " strcpy(givrListContEtab[giviNbContEtab].tcThm, rObjEtab.acTypobj);\n" \
13509  "\n" \
13510  " giviNbContEtab++;\n" \
13511  " }\n" \
13512  " }\n" \
13513  "\n" \
13514  " EXEC SQL\n" \
13515  " close crsLectureTypContEtab;\n" \
13516  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13517  "\n" \
13518  " if ((int4)GIV::GYBok != iIntRet)\n" \
13519  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureTypContEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
13520  "\n" \
13521  " return (iCodRet);\n" \
13522  "}\n" \
13523  "\n" \
13524  "/*----------------------------------Fonction----------------------------------*\n" \
13525  " * Fonction : givLectureContProfEtab\n" \
13526  " *\n" \
13527  " * But : liens eta-prof pour les contenus\n" \
13528  " *\n" \
13529  " * Description : Lecture\n" \
13530  " * dans la table GYTtabProfEtab.\n" \
13531  " *\n" \
13532  " *\n" \
13533  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
13534  "\n" \
13535  "int4 givLectureContProfEtab(char* apcEtab)\n" \
13536  "{\n" \
13537  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
13538  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
13539  " int4 i, j;\n" \
13540  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
13541  " EXEC SQL\n" \
13542  " begin declare\n" \
13543  " section;\n" \
13544  " char* pcOraEtab;\n" \
13545  " char acCodan8[GYBIaprofLgCodan8 + 1]; /* code AN8 */\n" \
13546  " int2 sCodan8I;\n" \
13547  " char cIndic;\n" \
13548  " char datmaj[GYBIeinscLgDatmod + 1]; /* date fin */\n" \
13549  " int2 sIndic;\n" \
13550  " char tcType[3]; /* type */\n" \
13551  " EXEC SQL\n" \
13552  " VAR pcOraEtab\n" \
13553  " IS STRING;\n" \
13554  " EXEC SQL\n" \
13555  " end declare\n" \
13556  " section;\n" \
13557  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
13558  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
13559  " pcOraEtab = apcEtab;\n" \
13560  " /* Traitement des erreurs SQL */\n" \
13561  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureContProfEtab\");\n" \
13562  " EXEC SQL\n" \
13563  " OPEN crsLectureContProfEtab\n" \
13564  " USING :pcOraEtab,:pcOraEtab,:pcOraEtab,:pcOraEtab,:pcOraEtab;\n" \
13565  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13566  "\n" \
13567  " if ((int4)GIV::GYBok != iIntRet)\n" \
13568  " {\n" \
13569  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureContProfEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
13570  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
13571  " }\n" \
13572  "\n" \
13573  " while ((int4)GIV::GYBok == iIntRet)\n" \
13574  " {\n" \
13575  " EXEC SQL\n" \
13576  " FETCH crsLectureContProfEtab\n" \
13577  " INTO\n" \
13578  " :cIndic,:tcType,:acCodan8:sCodan8I,:datmaj:sIndic;\n" \
13579  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13580  "\n" \
13581  " if ((int4)GIV::GYBok == iIntRet)\n" \
13582  " {\n" \
13583  " if (MAX_LIST_CONT == giviNbProfEtab)\n" \
13584  " {\n" \
13585  " GWTTrace(GWT_NIV_GRAVE, (\"Nombre de type de contenus des epj atteint %d\\n\", giviNbContEtab));\n" \
13586  " break;\n" \
13587  " }\n" \
13588  "\n" \
13589  " strcpy(givrListProfEtab[giviNbProfEtab].tcEtab, pcOraEtab);\n" \
13590  "\n" \
13591  " if (0 == sCodan8I)\n" \
13592  " {\n" \
13593  " for (i = 0; i < givrListParu.iNbrTot; i++)\n" \
13594  " {\n" \
13595  " j = givrListParu.trEltRangList[i];\n" \
13596  "\n" \
13597  " if (0 == strcmp(givrListParu.trEltList[j].rubinit, acCodan8))\n" \
13598  " break;\n" \
13599  " }\n" \
13600  "\n" \
13601  " if (givrListParu.iNbrTot == i)\n" \
13602  " {\n" \
13603  " /* code an8 absent du bloc */\n" \
13604  " continue;\n" \
13605  " }\n" \
13606  "\n" \
13607  " strcpy(givrListProfEtab[giviNbProfEtab].tcAn8, acCodan8);\n" \
13608  " }\n" \
13609  " else\n" \
13610  " givrListProfEtab[giviNbProfEtab].tcAn8[0] = '\\0';\n" \
13611  "\n" \
13612  " strcpy(givrListProfEtab[giviNbProfEtab].tcType, tcType);\n" \
13613  " givrListProfEtab[giviNbProfEtab].cIndic = cIndic;\n" \
13614  " giviNbProfEtab++;\n" \
13615  " }\n" \
13616  " }\n" \
13617  "\n" \
13618  " EXEC SQL\n" \
13619  " close crsLectureContProfEtab;\n" \
13620  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13621  "\n" \
13622  " if ((int4)GIV::GYBok != iIntRet)\n" \
13623  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureContProfEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
13624  "\n" \
13625  " return (iCodRet);\n" \
13626  "}\n" \
13627  "\n" \
13628  "/*----------------------------------Fonction----------------------------------*\n" \
13629  " * Fonction : givLectureOldEtab\n" \
13630  " *\n" \
13631  " * But : champs des anciens établissements.\n" \
13632  " *\n" \
13633  " * Description : Lecture\n" \
13634  " * dans la table GYTtabLiensEtab.\n" \
13635  " *\n" \
13636  " *\n" \
13637  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
13638  "\n" \
13639  "int4 givLectureOldEtab(char** buf_pos_in, char* apcEtab)\n" \
13640  "{\n" \
13641  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
13642  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
13643  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
13644  " EXEC SQL\n" \
13645  " begin declare\n" \
13646  " section;\n" \
13647  " char* pcOraEtab;\n" \
13648  " char tcEtab[GYBIeinscLgEtab2]; /* etab */\n" \
13649  " char cType; /* type */\n" \
13650  " char tcDatLien[GYBIeinscLgDatmod + 1]; /* date */\n" \
13651  " EXEC SQL\n" \
13652  " VAR pcOraEtab\n" \
13653  " IS STRING;\n" \
13654  " EXEC SQL\n" \
13655  " VAR tcEtab\n" \
13656  " IS STRING;\n" \
13657  " EXEC SQL\n" \
13658  " end declare\n" \
13659  " section;\n" \
13660  " char* buf;\n" \
13661  " char tcType[2];\n" \
13662  " int4 pipe;\n" \
13663  " int4 lg_ecr = 0;\n" \
13664  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
13665  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
13666  " pcOraEtab = apcEtab;\n" \
13667  " buf = *buf_pos_in;\n" \
13668  " pipe = 0;\n" \
13669  " /* Traitement des erreurs SQL */\n" \
13670  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureOldEtab\");\n" \
13671  " EXEC SQL\n" \
13672  " OPEN crsLectureOldEtab\n" \
13673  " USING: pcOraEtab;\n" \
13674  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13675  "\n" \
13676  " if ((int4)GIV::GYBok != iIntRet)\n" \
13677  " {\n" \
13678  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureOldEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
13679  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
13680  " }\n" \
13681  "\n" \
13682  " while ((int4)GIV::GYBok == iIntRet)\n" \
13683  " {\n" \
13684  " EXEC SQL\n" \
13685  " FETCH crsLectureOldEtab\n" \
13686  " INTO\n" \
13687  " :tcEtab,:cType,:tcDatLien;\n" \
13688  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13689  "\n" \
13690  " if ((int4)GIV::GYBok == iIntRet)\n" \
13691  " {\n" \
13692  " tcType[0] = cType;\n" \
13693  " tcType[1] = '\\0';\n" \
13694  "\n" \
13695  " if (0 == pipe)\n" \
13696  " {\n" \
13697  " pipe = 1;\n" \
13698  " strcpy(buf, \"<etab_repris type=\\\"\");\n" \
13699  " }\n" \
13700  " else\n" \
13701  " strcat(buf, \"<etab_repris type=\\\"\");\n" \
13702  "\n" \
13703  " strcat(buf, tcType);\n" \
13704  " strcat(buf, \"\\\"\");\n" \
13705  " strcat(buf, \" date_reprise=\\\"\");\n" \
13706  " strcat(buf, tcDatLien);\n" \
13707  " strcat(buf, \"\\\">\");\n" \
13708  "\n" \
13709  " if ('I' == cType)\n" \
13710  " strcat(buf, apcEtab);\n" \
13711  " else\n" \
13712  " strcat(buf, tcEtab);\n" \
13713  "\n" \
13714  " strcat(buf, \"</etab_repris>\");\n" \
13715  " lg_ecr = strlen(buf);\n" \
13716  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
13717  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
13718  " *(buf + lg_ecr + 2) = '\\0';\n" \
13719  " buf = buf + lg_ecr + 2;\n" \
13720  " }\n" \
13721  " }\n" \
13722  "\n" \
13723  " EXEC SQL\n" \
13724  " close crsLectureOldEtab;\n" \
13725  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
13726  "\n" \
13727  " if ((int4)GIV::GYBok != iIntRet)\n" \
13728  " {\n" \
13729  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureOldEtab: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
13730  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
13731  " }\n" \
13732  "\n" \
13733  " *buf_pos_in = buf;\n" \
13734  " return (iCodRet);\n" \
13735  "}\n" \
13736  "\n" \
13737  "/*----Fonction----------------------------------------------------------------*/\n" \
13738  "/* */\n" \
13739  "/* Fonction : giv_ecrit_partie_3_obj () */\n" \
13740  "/* */\n" \
13741  "/* But : ecrit la partie trois par objet */\n" \
13742  "/* */\n" \
13743  "/* */\n" \
13744  "/* Entree(s) : un buffer, Structure Document */\n" \
13745  "/* */\n" \
13746  "/* Sortie(s) : OK ou KO */\n" \
13747  "/* */\n" \
13748  "/* Portable : Transparent */\n" \
13749  "/* */\n" \
13750  "/*----------------------------------------------------------------------------*/\n" \
13751  "\n" \
13752  "int4 giv_ecrit_partie_3_obj(char** buf_pos_in, GYBrDOCUMENTEpj* docClone)\n" \
13753  "{\n" \
13754  " int4 lg; /* Logueur du champ à traiter */\n" \
13755  " int4 lg_write;\n" \
13756  " char* buf_pos;\n" \
13757  " int4 iCodRet; /* Code retour de la fonction */\n" \
13758  " int4 pipe; /* Flag pour ajout pipe */\n" \
13759  " int4 i, j, k, p, q, l;\n" \
13760  " int4 iIntRet = GIV::GWCCodeOK;\n" \
13761  " int4 iRgLigne, iObj;\n" \
13762  " int4 iRg, iAlpha, iAn9, iNbGeoTri;\n" \
13763  " char* pt_fin_lst;\n" \
13764  " char* pt_debut;\n" \
13765  " char* pt_fin;\n" \
13766  " char tcRub[GYBIaprofLgCodan8 + GYBPaprofLgCodan9 + 1];\n" \
13767  " iCodRet = GIV::GWCCodeOK;\n" \
13768  " /* Initialisation pointeur */\n" \
13769  " buf_pos = *buf_pos_in;\n" \
13770  " /* Initialisation pointeur */\n" \
13771  " buf_pos = *buf_pos_in;\n" \
13772  "\n" \
13773  " for (i = 0; i < givrListObj.iNbrTri; i++)\n" \
13774  " {\n" \
13775  " iAlpha = -1;\n" \
13776  " pipe = 0;\n" \
13777  "\n" \
13778  " for (j = 0; j < givrListObj.iNbr; j++)\n" \
13779  " {\n" \
13780  " k = givrListObj.trEltRangListObj[j];\n" \
13781  "\n" \
13782  " if (i != givrListObj.trEltListObj[k].iRangTri)\n" \
13783  " continue;\n" \
13784  "\n" \
13785  " iRgLigne = givrListObj.trEltListObj[k].iRgLigne;\n" \
13786  " iObj = givrListObj.trEltListObj[k].iRgObj;\n" \
13787  "\n" \
13788  " for (p = 0; p < givrListParu.iNbrTot; p++)\n" \
13789  " {\n" \
13790  " q = givrListParu.trEltRangList[p];\n" \
13791  "\n" \
13792  " if (iRgLigne != givrListParu.trEltList[q].iRgLigne)\n" \
13793  " continue;\n" \
13794  "\n" \
13795  " if (0 == strcmp((docClone + iRgLigne)->value.objets_pub.micro[iObj].stype, \"DV\"))\n" \
13796  " {\n" \
13797  " for (l = 0; l < giviNbProfEtab; l++)\n" \
13798  " {\n" \
13799  " if (('V' == givrListProfEtab[l].cIndic) && (0 == strcmp(givrListProfEtab[l].tcType, \"DV\")) && (0 == strcmp(givrListProfEtab[l].tcAn8, givrListParu.trEltList[q].rubinit)))\n" \
13800  " break;\n" \
13801  " }\n" \
13802  "\n" \
13803  " if (giviNbProfEtab == l)\n" \
13804  " continue;\n" \
13805  " }\n" \
13806  "\n" \
13807  " if (0 == strcmp(givrListParu.trEltList[q].rub, givcR00000000))\n" \
13808  " iAn9 = 1;\n" \
13809  " else if (pipe == 0)\n" \
13810  " {\n" \
13811  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"objetrubrique\");\n" \
13812  " buf_pos = buf_pos + lg_write;\n" \
13813  " iIntRet = giv_ecrit_objet_pub(&buf_pos, docClone, iRgLigne, iObj, \"objetrub\");\n" \
13814  " strcpy(buf_concat, givrListParu.trEltList[q].rubinit);\n" \
13815  " strcat(buf_concat, givrListParu.trEltList[q].rub);\n" \
13816  " pipe = 1;\n" \
13817  " }\n" \
13818  " else\n" \
13819  " {\n" \
13820  " strcpy(tcRub, givrListParu.trEltList[q].rubinit);\n" \
13821  " strcat(tcRub, givrListParu.trEltList[q].rub);\n" \
13822  "\n" \
13823  " if ((0 == strstr(buf_concat, tcRub)) && ((int4)strlen(buf_concat) < ((int4)sizeof(buf_concat) - (int4)strlen(givcR000000) - (int4)strlen(givcR000000))))\n" \
13824  " {\n" \
13825  " strcat(buf_concat, \"|\");\n" \
13826  " strcat(buf_concat, givrListParu.trEltList[q].rubinit);\n" \
13827  " strcat(buf_concat, givrListParu.trEltList[q].rub);\n" \
13828  " }\n" \
13829  " }\n" \
13830  " }\n" \
13831  " }\n" \
13832  "\n" \
13833  " if (1 == pipe)\n" \
13834  " {\n" \
13835  " iIntRet = supprimer_doublon(buf_concat, '|');\n" \
13836  " pt_fin_lst = buf_concat + strlen(buf_concat);\n" \
13837  "\n" \
13838  " for (pt_debut = buf_concat; pt_debut < pt_fin_lst;)\n" \
13839  " {\n" \
13840  " pt_fin = strchr(pt_debut, '|');\n" \
13841  "\n" \
13842  " if (pt_fin == 0)\n" \
13843  " pt_fin = pt_fin_lst;\n" \
13844  "\n" \
13845  " /* analyse rub */\n" \
13846  " memcpy(tcRub, pt_debut, GYBIaprofLgCodan8);\n" \
13847  " tcRub[GYBIaprofLgCodan8] = '\\0';\n" \
13848  " lg_write = giv_ecrit_element(buf_pos, \"objetan8\", tcRub);\n" \
13849  " buf_pos = buf_pos + lg_write;\n" \
13850  " memcpy(tcRub, pt_debut + GYBIaprofLgCodan8, GYBPaprofLgCodan9);\n" \
13851  " tcRub[GYBPaprofLgCodan9] = '\\0';\n" \
13852  " lg_write = giv_ecrit_element(buf_pos, \"objetan9\", tcRub);\n" \
13853  " buf_pos = buf_pos + lg_write;\n" \
13854  " pt_debut = pt_fin + 1;\n" \
13855  " }\n" \
13856  "\n" \
13857  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"objetrubrique\");\n" \
13858  " buf_pos = buf_pos + lg_write;\n" \
13859  " }\n" \
13860  " }\n" \
13861  "\n" \
13862  " *buf_pos_in = buf_pos;\n" \
13863  " return (iCodRet);\n" \
13864  "}\n" \
13865  "\n" \
13866  "int4 givInclusionRubrique(char* atcRub, GYBrDOCUMENTEpj* doc, int4 aiRef)\n" \
13867  "{\n" \
13868  " int4 iCodRet; /* Code retour de la fonction */\n" \
13869  " int4 i, j, k, p, q;\n" \
13870  " int4 iIntRet = GIV::GWCCodeOK;\n" \
13871  " int4 iRang, iRgLigne;\n" \
13872  " iCodRet = (int4)GIV::GWCCodeKO;\n" \
13873  " iRang = doc->value.objets_pub.micro[aiRef].iRgObj;\n" \
13874  " GWTTrace(GWT_NIV_FONCT, (\" Rang objet-rub %d-%s\\n\", iRang, atcRub));\n" \
13875  "\n" \
13876  " for (j = 0; j < givrListObj.iNbr; j++)\n" \
13877  " {\n" \
13878  " k = givrListObj.trEltRangListObj[j];\n" \
13879  "\n" \
13880  " if (iRang != givrListObj.trEltListObj[k].iRangTri)\n" \
13881  " continue;\n" \
13882  "\n" \
13883  " iRgLigne = givrListObj.trEltListObj[k].iRgLigne;\n" \
13884  " GWTTrace(GWT_NIV_FONCT, (\" Rang ligne %d\\n\", iRgLigne));\n" \
13885  "\n" \
13886  " for (p = 0; p < givrListParu.iNbrTot; p++)\n" \
13887  " {\n" \
13888  " q = givrListParu.trEltRangList[p];\n" \
13889  "\n" \
13890  " if (iRgLigne != givrListParu.trEltList[q].iRgLigne)\n" \
13891  " continue;\n" \
13892  "\n" \
13893  " GWTTrace(GWT_NIV_FONCT, (\" Rubrique %s\\n\", givrListParu.trEltList[q].rubinit));\n" \
13894  "\n" \
13895  " if (0 == strcmp(givrListParu.trEltList[q].rubinit, atcRub))\n" \
13896  " {\n" \
13897  " iCodRet = (int4)GIV::GWCCodeOK;\n" \
13898  " GWTTrace(GWT_NIV_FONCT, (\" Rubrique trouvée %s\\n\", givrListParu.trEltList[q].rubinit));\n" \
13899  " }\n" \
13900  " }\n" \
13901  " }\n" \
13902  "\n" \
13903  " return (iCodRet);\n" \
13904  "}\n" \
13905  "\n" \
13906  "/*----Fonction----------------------------------------------------------------*/\n" \
13907  "/* */\n" \
13908  "/* Fonction : giv_ecrit_partie_3_ins () */\n" \
13909  "/* */\n" \
13910  "/* But : ecrit la partie trois par inscription */\n" \
13911  "/* */\n" \
13912  "/* */\n" \
13913  "/* Entree(s) : un buffer, Structure Document */\n" \
13914  "/* */\n" \
13915  "/* Sortie(s) : OK ou KO */\n" \
13916  "/* */\n" \
13917  "/* Portable : Transparent */\n" \
13918  "/* */\n" \
13919  "/*----------------------------------------------------------------------------*/\n" \
13920  "\n" \
13921  "int4 giv_ecrit_partie_3_ins(char** buf_pos_in, GYBrDOCUMENTEpj* docClone, int4 indice)\n" \
13922  "{\n" \
13923  " char* buf_pos;\n" \
13924  " int4 iCodRet, iRet; /* Code retour de la fonction */\n" \
13925  " int4 m;\n" \
13926  " int4 jRef;\n" \
13927  " int4 lg_write;\n" \
13928  " iCodRet = GIV::GWCCodeOK;\n" \
13929  " /* Initialisation pointeur */\n" \
13930  " buf_pos = *buf_pos_in;\n" \
13931  "\n" \
13932  " if (0 == strcmp(givtcParuInscEpj, \"OUI\"))\n" \
13933  " {\n" \
13934  " /* parution géographique par inscription */\n" \
13935  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"iparution\");\n" \
13936  " buf_pos = buf_pos + lg_write;\n" \
13937  " jRef = 0;\n" \
13938  " m = 0;\n" \
13939  " /* géopgaphie du moyen de communication */\n" \
13940  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_ARR, GIV::giv_ARR, \"ipjdeplocarr\");\n" \
13941  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_ARR, GIV::giv_LOC, \"ipjdeplocarrextra\");\n" \
13942  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_LOC, GIV::giv_LOC, \"ipjdeploc\");\n" \
13943  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_LOC, GIV::giv_ZU, \"ipjdeploczoneurbaine\");\n" \
13944  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_LOC, GIV::giv_DEPT, \"ipjdeplocextraloc\");\n" \
13945  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_ARR, GIV::giv_DEPT, \"ipjdeplocarrextraloc\");\n" \
13946  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_LOC, GIV::giv_EXTL, \"ipjdeplocextradep\");\n" \
13947  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_ARR, GIV::giv_EXTL, \"ipjdeplocarrextradep\");\n" \
13948  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_DEPT, GIV::giv_DEPT, \"ipjdep\");\n" \
13949  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_DEPT, GIV::giv_EXTL, \"ipjdepextra\");\n" \
13950  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_REG, GIV::giv_REG, \"ipjreg\");\n" \
13951  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_REG, GIV::giv_EXTL, \"ipjregextra\");\n" \
13952  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"iparution\");\n" \
13953  " buf_pos = buf_pos + lg_write;\n" \
13954  " }\n" \
13955  "\n" \
13956  " /* Fin de l'entité inscription */\n" \
13957  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"inscription\");\n" \
13958  " buf_pos = buf_pos + lg_write;\n" \
13959  " *buf_pos_in = buf_pos;\n" \
13960  " return (iCodRet);\n" \
13961  "} /* Fin ecrit partie_3_ins */\n" \
13962  "\n" \
13963  "/*----Fonction----------------------------------------------------------------*/\n" \
13964  "/* */\n" \
13965  "/* Fonction : giv_ecrit_noeud_rubriques () */\n" \
13966  "/* */\n" \
13967  "/* But : ecrit rubrique avec les codes an9 an8 si ceux ci sont fournis */\n" \
13968  "/* */\n" \
13969  "/* */\n" \
13970  "/* Entree(s) : un buffer, les differents codes */\n" \
13971  "/* */\n" \
13972  "/* Sortie(s) : OK ou KO */\n" \
13973  "/* */\n" \
13974  "/* Portable : Transparent */\n" \
13975  "/* */\n" \
13976  "/*----------------------------------------------------------------------------*/\n" \
13977  "\n" \
13978  "static int4 giv_ecrit_noeud_rubriques(char* buf, char* val_codan8, char* val_codan9, char orig, const std::string& thematique = \"\")\n" \
13979  "{\n" \
13980  " int4 lg_ecr;\n" \
13981  " GIVBuffInter[0] = '\\0';\n" \
13982  "\n" \
13983  " std::stringstream stream;\n" \
13984  "\n" \
13985  " if (orig != '4' && orig != '6' && orig != '7')\n" \
13986  " orig = '1';\n" \
13987  "\n" \
13988  " stream << \"<rubrique\" << \" origine=\\\"\" << orig << \"\\\"\"\n" \
13989  " << \" codan8=\\\"\" << val_codan8 << \"\\\"\"\n" \
13990  " << \" codan9=\\\"\" << val_codan9 << \"\\\"\";\n" \
13991  "\n" \
13992  " if (thematique == \"MEDECIN\")\n" \
13993  " stream << \" sante=\\\"1\\\"\";\n" \
13994  "\n" \
13995  " if (!thematique.empty())\n" \
13996  " stream << \" thematique=\\\"\" << thematique << \"\\\"\";\n" \
13997  "\n" \
13998  " stream << \">\";\n" \
13999  "\n" \
14000  " if (strcmp(val_codan9, givcR00000000) != 0)\n" \
14001  " {\n" \
14002  " /* Afficher le texte de la rubrique (uniquement le premier) */\n" \
14003  " /* Appel a la fonction de lecture du libelle de rubrique */\n" \
14004  " givLectureLibRub(val_codan9);\n" \
14005  " }\n" \
14006  "\n" \
14007  " strcat(buf, stream.str().c_str());\n" \
14008  " strcat(buf, GIVBuffInter);\n" \
14009  " strcat(buf, \"</rubrique>\");\n" \
14010  " lg_ecr = strlen(buf);\n" \
14011  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14012  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14013  " *(buf + lg_ecr + 2) = '\\0';\n" \
14014  " lg_ecr = lg_ecr + 2;\n" \
14015  " return (lg_ecr);\n" \
14016  "}\n" \
14017  "\n" \
14018  "/*----Fonction----------------------------------------------------------------*/\n" \
14019  "/* */\n" \
14020  "/* Fonction : giv_ecrit_noeud_partenaire () */\n" \
14021  "/* */\n" \
14022  "/* But : ecrit origine et ref de partenaire */\n" \
14023  "/* */\n" \
14024  "/* */\n" \
14025  "/* Entree(s) : un buffer, les differents codes */\n" \
14026  "/* */\n" \
14027  "/* Sortie(s) : OK ou KO */\n" \
14028  "/* */\n" \
14029  "/* Portable : Transparent */\n" \
14030  "/* */\n" \
14031  "/*----------------------------------------------------------------------------*/\n" \
14032  "\n" \
14033  "static int4 giv_ecrit_noeud_partenaire(char** buf_in, char* val, char* blocid, char* etab)\n" \
14034  "{\n" \
14035  " int4 lg_ecr, iIntRet;\n" \
14036  " char* buf;\n" \
14037  " buf = *buf_in;\n" \
14038  "\n" \
14039  " if (0 == strlen(buf))\n" \
14040  " strcpy(buf, \"<\");\n" \
14041  " else\n" \
14042  " strcat(buf, \"<\");\n" \
14043  "\n" \
14044  " strcat(buf, \"info_part\");\n" \
14045  " strcat(buf, \" \");\n" \
14046  " strcat(buf, \"source\");\n" \
14047  " strcat(buf, \"=\");\n" \
14048  " strcat(buf, \"\\\"\");\n" \
14049  " strcat(buf, &val[strlen(val) - 4]);\n" \
14050  " strcat(buf, \"\\\"\");\n" \
14051  " strcat(buf, \" \");\n" \
14052  " strcat(buf, \"ref\");\n" \
14053  " strcat(buf, \"=\");\n" \
14054  " strcat(buf, \"\\\"\");\n" \
14055  " lg_ecr = strlen(buf);\n" \
14056  " memcpy(&buf[lg_ecr], val, strlen(val) - 4);\n" \
14057  " *(buf + lg_ecr + strlen(val) - 4) = '\\0';\n" \
14058  " strcat(buf, \"\\\"\");\n" \
14059  " strcat(buf, \" \");\n" \
14060  " strcat(buf, \"id\");\n" \
14061  " strcat(buf, \"=\");\n" \
14062  " strcat(buf, \"\\\"\");\n" \
14063  " strcat(buf, blocid);\n" \
14064  " strcat(buf, \"\\\"\");\n" \
14065  " strcat(buf, \" \");\n" \
14066  " strcat(buf, \"etab\");\n" \
14067  " strcat(buf, \"=\");\n" \
14068  " strcat(buf, \"\\\"\");\n" \
14069  " strcat(buf, etab);\n" \
14070  " strcat(buf, \"\\\"\");\n" \
14071  " strcat(buf, \" />\");\n" \
14072  " lg_ecr = strlen(buf);\n" \
14073  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14074  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14075  " *(buf + lg_ecr + 2) = '\\0';\n" \
14076  " lg_ecr = lg_ecr + 2;\n" \
14077  " buf = buf + lg_ecr;\n" \
14078  " iIntRet = givOppositionPart(&buf, val);\n" \
14079  " *buf_in = buf;\n" \
14080  " iIntRet = GIV::GWCCodeOK;\n" \
14081  " return (iIntRet);\n" \
14082  "}\n" \
14083  "\n" \
14084  "/*----Fonction----------------------------------------------------------------*/\n" \
14085  "/* */\n" \
14086  "/* Fonction : giv_ecrit_element_partenaire () */\n" \
14087  "/* */\n" \
14088  "/* But : ecrit origine et ref de partenaire pour mutualisation */\n" \
14089  "/* */\n" \
14090  "/* */\n" \
14091  "/* Entree(s) : un buffer, les differents codes */\n" \
14092  "/* */\n" \
14093  "/* Sortie(s) : OK ou KO */\n" \
14094  "/* */\n" \
14095  "/* Portable : Transparent */\n" \
14096  "/* */\n" \
14097  "/*----------------------------------------------------------------------------*/\n" \
14098  "\n" \
14099  "static int4 giv_ecrit_element_partenaire(char* nom_balise, char* buf, char* val, char* etab, char* parent)\n" \
14100  "{\n" \
14101  " int4 lg_ecr;\n" \
14102  "\n" \
14103  " if (0 == strlen(buf))\n" \
14104  " strcpy(buf, \"<\");\n" \
14105  " else\n" \
14106  " strcat(buf, \"<\");\n" \
14107  "\n" \
14108  " if (0 != strcmp(givtcPartInsc, \"OUI\"))\n" \
14109  " {\n" \
14110  " strcat(buf, nom_balise);\n" \
14111  " strcat(buf, \" id=\");\n" \
14112  " strcat(buf, \"\\\"\");\n" \
14113  " strcat(buf, val);\n" \
14114  " strcat(buf, \"\\\"\");\n" \
14115  " strcat(buf, \" \");\n" \
14116  " }\n" \
14117  " else\n" \
14118  " {\n" \
14119  " strcat(buf, nom_balise);\n" \
14120  " strcat(buf, \" \");\n" \
14121  " strcat(buf, \"source\");\n" \
14122  " strcat(buf, \"=\");\n" \
14123  " strcat(buf, \"\\\"\");\n" \
14124  " strcat(buf, &val[strlen(val) - 4]);\n" \
14125  " strcat(buf, \"\\\"\");\n" \
14126  " strcat(buf, \" \");\n" \
14127  " strcat(buf, \"id\");\n" \
14128  " strcat(buf, \"=\");\n" \
14129  " strcat(buf, \"\\\"\");\n" \
14130  " lg_ecr = strlen(buf);\n" \
14131  " memcpy(&buf[lg_ecr], val, strlen(val) - 4);\n" \
14132  " *(buf + lg_ecr + strlen(val) - 4) = '\\0';\n" \
14133  " strcat(buf, \"\\\"\");\n" \
14134  " strcat(buf, \" \");\n" \
14135  "\n" \
14136  " if ((0 == strcmp(giv_PJDC, &val[strlen(val) - 4])) && (0 != strlen(parent)))\n" \
14137  " {\n" \
14138  " strcat(buf, \"parentId\");\n" \
14139  " strcat(buf, \"=\");\n" \
14140  " strcat(buf, \"\\\"\");\n" \
14141  " strcat(buf, parent);\n" \
14142  " strcat(buf, \"\\\"\");\n" \
14143  " strcat(buf, \" \");\n" \
14144  " }\n" \
14145  " }\n" \
14146  "\n" \
14147  " strcat(buf, \"etab\");\n" \
14148  " strcat(buf, \"=\");\n" \
14149  " strcat(buf, \"\\\"\");\n" \
14150  " strcat(buf, etab);\n" \
14151  " strcat(buf, \"\\\"\");\n" \
14152  " strcat(buf, \">\");\n" \
14153  " lg_ecr = strlen(buf);\n" \
14154  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14155  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14156  " *(buf + lg_ecr + 2) = '\\0';\n" \
14157  " lg_ecr = lg_ecr + 2;\n" \
14158  " return (lg_ecr);\n" \
14159  "}\n" \
14160  "\n" \
14161  "/*----Fonction----------------------------------------------------------------*/\n" \
14162  "/* */\n" \
14163  "/* Fonction : GIV_ecrit_element_parent () */\n" \
14164  "/* */\n" \
14165  "/* But : ecrit parnet de partenaire */\n" \
14166  "/* */\n" \
14167  "/* */\n" \
14168  "/* Entree(s) : un buffer, les differents codes */\n" \
14169  "/* */\n" \
14170  "/* Sortie(s) : OK ou KO */\n" \
14171  "/* */\n" \
14172  "/* Portable : Transparent */\n" \
14173  "/* */\n" \
14174  "/*----------------------------------------------------------------------------*/\n" \
14175  "\n" \
14176  "int4 GIV_ecrit_element_parent(char** buf_pos_in, GYBrIapartT* prPart)\n" \
14177  "{\n" \
14178  " int4 iRet;\n" \
14179  " int4 lg_ecr = 0;\n" \
14180  " char* buf;\n" \
14181  " char tcIntl[GYBIeinscLgDenom2 + GYBIeinscLgPrenom2];\n" \
14182  " /* Initialisation pointeur */\n" \
14183  " buf = *buf_pos_in;\n" \
14184  "\n" \
14185  " if (giv_cPJDC == prPart->acTypeRefPart[0])\n" \
14186  " {\n" \
14187  " prPart->openElementCabinet(buf);\n" \
14188  " lg_ecr = strlen(buf);\n" \
14189  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14190  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14191  " *(buf + lg_ecr + 2) = '\\0';\n" \
14192  " lg_ecr = lg_ecr + 2;\n" \
14193  " buf = buf + lg_ecr;\n" \
14194  " /* Ecriture dans le fichier de sortie */\n" \
14195  " iRet = giv_sortie(&buf, GIVfDescFicBloc);\n" \
14196  " prPart->concatDenominationPrenom(tcIntl, givtcInvDenPn);\n" \
14197  " lg_ecr = giv_ecrit_balise_epj(&buf, tcIntl, \"denom\");\n" \
14198  " strcat(buf, \"</cabinet>\");\n" \
14199  " lg_ecr = strlen(buf);\n" \
14200  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14201  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14202  " *(buf + lg_ecr + 2) = '\\0';\n" \
14203  " lg_ecr = lg_ecr + 2;\n" \
14204  " }\n" \
14205  " else if (giv_prPJDC == prPart->acTypeRefPart[0])\n" \
14206  " {\n" \
14207  " prPart->openParentElementMedecin(buf);\n" \
14208  " lg_ecr = strlen(buf);\n" \
14209  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14210  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14211  " *(buf + lg_ecr + 2) = '\\0';\n" \
14212  " lg_ecr = lg_ecr + 2;\n" \
14213  " buf = buf + lg_ecr;\n" \
14214  " /* Ecriture dans le fichier de sortie */\n" \
14215  " iRet = giv_sortie(&buf, GIVfDescFicBloc);\n" \
14216  " prPart->concatDenominationPrenom(tcIntl, givtcInvDenPn);\n" \
14217  " lg_ecr = giv_ecrit_balise_epj(&buf, tcIntl, \"denom\");\n" \
14218  " iRet = givExtractPartEtab(prPart, &buf, giv_PHO);\n" \
14219  " /* Ecriture dans le fichier de sortie */\n" \
14220  " iRet = (int4)giv_sortie(&buf, GIVfDescFicBloc);\n" \
14221  " strcpy(buf, \"<rubrique\");\n" \
14222  " strcat(buf, \" \");\n" \
14223  " strcat(buf, \"an9\");\n" \
14224  " strcat(buf, \"=\\\"\");\n" \
14225  " strcat(buf, prPart->acCodan9);\n" \
14226  " strcat(buf, \"\\\">\");\n" \
14227  "\n" \
14228  " if (0 != strlen(prPart->acCodan9))\n" \
14229  " {\n" \
14230  " /* Afficher le texte de la rubrique (uniquement le premier) */\n" \
14231  " /* Appel a la fonction de lecture du libelle de rubrique */\n" \
14232  " iRet = givLectureLibRub(prPart->acCodan9);\n" \
14233  " strcat(buf, GIVBuffInter);\n" \
14234  " }\n" \
14235  "\n" \
14236  " strcat(buf, \"</\");\n" \
14237  " strcat(buf, \"rubrique\");\n" \
14238  " strcat(buf, \">\");\n" \
14239  " lg_ecr = strlen(buf);\n" \
14240  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14241  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14242  " *(buf + lg_ecr + 2) = '\\0';\n" \
14243  " lg_ecr = lg_ecr + 2;\n" \
14244  " strcat(buf, \"</medecin>\");\n" \
14245  " lg_ecr = strlen(buf);\n" \
14246  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14247  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14248  " *(buf + lg_ecr + 2) = '\\0';\n" \
14249  " lg_ecr = lg_ecr + 2;\n" \
14250  " /* Ecriture dans le fichier de sortie */\n" \
14251  " iRet = (int4)giv_sortie_ISO(&buf, GIVfDescFicBloc);\n" \
14252  " lg_ecr = 0;\n" \
14253  " }\n" \
14254  " else\n" \
14255  " GWTTrace(GWT_NIV_GRAVE, (\"WARNING : type de référence de partenaire erroné : <%c> epj <%s>\\n\", prPart->acTypeRefPart[0], prPart->acEtab));\n" \
14256  "\n" \
14257  " *buf_pos_in = buf;\n" \
14258  " return (lg_ecr);\n" \
14259  "}\n" \
14260  "\n" \
14261  "int4 giv_ecrit_elements_nav(char** buf_pos_in, GYBrIapartT* prPart)\n" \
14262  "{\n" \
14263  " int4 iRet;\n" \
14264  " int4 lg_ecr = 0;\n" \
14265  " char* buf;\n" \
14266  " char tcIntl[GYBIeinscLgDenom2 + GYBIeinscLgPrenom2];\n" \
14267  " /* Initialisation pointeur */\n" \
14268  " buf = *buf_pos_in;\n" \
14269  "\n" \
14270  " if (giv_prPJDC == prPart->acTypeRefPart[0])\n" \
14271  " {\n" \
14272  " prPart->openNavElementMedecin(buf);\n" \
14273  " lg_ecr = strlen(buf);\n" \
14274  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14275  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14276  " *(buf + lg_ecr + 2) = '\\0';\n" \
14277  " lg_ecr = lg_ecr + 2;\n" \
14278  " buf = buf + lg_ecr;\n" \
14279  " /* Ecriture dans le fichier de sortie */\n" \
14280  " iRet = giv_sortie(&buf, GIVfDescFicBloc);\n" \
14281  " prPart->concatDenominationPrenom(tcIntl, givtcInvDenPn);\n" \
14282  " lg_ecr = giv_ecrit_balise_epj(&buf, tcIntl, \"denom\");\n" \
14283  " prPart->openElementRubrique(buf);\n" \
14284  "\n" \
14285  " if (0 != strlen(prPart->acCodan9))\n" \
14286  " {\n" \
14287  " /* Afficher le texte de la rubrique (uniquement le premier) */\n" \
14288  " /* Appel a la fonction de lecture du libelle de rubrique */\n" \
14289  " iRet = givLectureLibRub(prPart->acCodan9);\n" \
14290  " strcat(buf, GIVBuffInter);\n" \
14291  " }\n" \
14292  "\n" \
14293  " strcat(buf, \"</\");\n" \
14294  " strcat(buf, \"rubrique\");\n" \
14295  " strcat(buf, \">\");\n" \
14296  " lg_ecr = strlen(buf);\n" \
14297  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14298  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14299  " *(buf + lg_ecr + 2) = '\\0';\n" \
14300  " lg_ecr = lg_ecr + 2;\n" \
14301  " /* Ecriture dans le fichier de sortie */\n" \
14302  " iRet = (int4)giv_sortie_ISO(&buf, GIVfDescFicBloc);\n" \
14303  " iRet = givExtractPartEtab(prPart, &buf, giv_PHO);\n" \
14304  " /* Ecriture dans le fichier de sortie */\n" \
14305  " iRet = (int4)giv_sortie(&buf, GIVfDescFicBloc);\n" \
14306  " strcpy(buf, \"</medecin>\");\n" \
14307  " lg_ecr = strlen(buf);\n" \
14308  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14309  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14310  " *(buf + lg_ecr + 2) = '\\0';\n" \
14311  " lg_ecr = lg_ecr + 2;\n" \
14312  " /* Ecriture dans le fichier de sortie */\n" \
14313  " iRet = (int4)giv_sortie_ISO(&buf, GIVfDescFicBloc);\n" \
14314  " lg_ecr = 0;\n" \
14315  " }\n" \
14316  " else if ((giv_orPJDC == prPart->acTypeRefPart[0]) || (giv_svPJDC == prPart->acTypeRefPart[0]) || (giv_cPJDC == prPart->acTypeRefPart[0]))\n" \
14317  " {\n" \
14318  " if (0 == strlen(buf))\n" \
14319  " strcpy(buf, \"<\");\n" \
14320  " else\n" \
14321  " strcat(buf, \"<\");\n" \
14322  "\n" \
14323  " if (giv_orPJDC == prPart->acTypeRefPart[0])\n" \
14324  " strcat(buf, \"organisation\");\n" \
14325  " else if (giv_svPJDC == prPart->acTypeRefPart[0])\n" \
14326  " {\n" \
14327  " strcat(buf, \"service\");\n" \
14328  "\n" \
14329  " if (0 == strlen(prPart->acParentRefPart))\n" \
14330  " {\n" \
14331  " strcat(buf, \" \");\n" \
14332  " strcat(buf, \"ref\");\n" \
14333  " strcat(buf, \"=\");\n" \
14334  " strcat(buf, \"\\\"\");\n" \
14335  " strcat(buf, prPart->acRefPart);\n" \
14336  " strcat(buf, \"\\\"\");\n" \
14337  " }\n" \
14338  " }\n" \
14339  " else\n" \
14340  " strcat(buf, \"cabinet\");\n" \
14341  "\n" \
14342  " strcat(buf, \" \");\n" \
14343  " strcat(buf, \"epj\");\n" \
14344  " strcat(buf, \"=\");\n" \
14345  " strcat(buf, \"\\\"\");\n" \
14346  " strcat(buf, prPart->acEtab);\n" \
14347  " strcat(buf, \"\\\">\");\n" \
14348  " lg_ecr = strlen(buf);\n" \
14349  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14350  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14351  " *(buf + lg_ecr + 2) = '\\0';\n" \
14352  " lg_ecr = lg_ecr + 2;\n" \
14353  " buf = buf + lg_ecr;\n" \
14354  " /* Ecriture dans le fichier de sortie */\n" \
14355  " iRet = giv_sortie(&buf, GIVfDescFicBloc);\n" \
14356  " prPart->concatDenominationPrenom(tcIntl, givtcInvDenPn);\n" \
14357  " lg_ecr = giv_ecrit_balise_epj(&buf, tcIntl, \"denom\");\n" \
14358  "\n" \
14359  " if ((giv_svPJDC == prPart->acTypeRefPart[0]) && (0 == strlen(prPart->acParentRefPart)))\n" \
14360  " {\n" \
14361  " /* calendrier d'un service d'une organisation */\n" \
14362  " iRet = givExtractPartEtab(prPart, &buf, giv_CAL);\n" \
14363  " /* Ecriture dans le fichier de sortie */\n" \
14364  " iRet = (int4)giv_sortie(&buf, GIVfDescFicBloc);\n" \
14365  " }\n" \
14366  "\n" \
14367  " iRet = givExtractPartEtab(prPart, &buf, giv_PHO);\n" \
14368  " /* Ecriture dans le fichier de sortie */\n" \
14369  " iRet = (int4)giv_sortie(&buf, GIVfDescFicBloc);\n" \
14370  "\n" \
14371  " if (giv_orPJDC == prPart->acTypeRefPart[0])\n" \
14372  " strcpy(buf, \"</organisation>\");\n" \
14373  " else if (giv_svPJDC == prPart->acTypeRefPart[0])\n" \
14374  " strcpy(buf, \"</service>\");\n" \
14375  " else\n" \
14376  " strcpy(buf, \"</cabinet>\");\n" \
14377  "\n" \
14378  " lg_ecr = strlen(buf);\n" \
14379  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14380  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14381  " *(buf + lg_ecr + 2) = '\\0';\n" \
14382  " lg_ecr = lg_ecr + 2;\n" \
14383  " }\n" \
14384  " else\n" \
14385  " GWTTrace(GWT_NIV_GRAVE, (\"WARNING : type de référence de partenaire erroné : <%c> epj <%s>\\n\", prPart->acTypeRefPart[0], prPart->acEtab));\n" \
14386  "\n" \
14387  " *buf_pos_in = buf;\n" \
14388  " return (lg_ecr);\n" \
14389  "}\n" \
14390  "int4 giv_ecrit_navigation(char** buf_pos_in, int4 aiRgParent, int4 aiNbParent, char pcTypeRef, GYBrIapartT* prPart, char* pcCleRef)\n" \
14391  "{\n" \
14392  " int4 iCodRet;\n" \
14393  " char* buf_pos;\n" \
14394  " int4 lg_write = 0;\n" \
14395  " int4 i;\n" \
14396  " /* Initialisation pointeur */\n" \
14397  " buf_pos = *buf_pos_in;\n" \
14398  "\n" \
14399  " if (giv_orPJDC == pcTypeRef)\n" \
14400  " {\n" \
14401  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"navOrganisation\");\n" \
14402  " buf_pos = buf_pos + lg_write;\n" \
14403  " lg_write = giv_ecrit_noeud_attr(buf_pos, \"services\", pcCleRef);\n" \
14404  " buf_pos = buf_pos + lg_write;\n" \
14405  "\n" \
14406  " for (i = aiRgParent; i < (aiRgParent + aiNbParent); i++)\n" \
14407  " {\n" \
14408  " /* référence de parent inutile : attribut ref de navigation présent */\n" \
14409  " givtrPart[i].acParentRefPart[0] = '\\0';\n" \
14410  " lg_write = giv_ecrit_elements_nav(&buf_pos, &givtrPart[i]);\n" \
14411  " buf_pos = buf_pos + lg_write;\n" \
14412  " }\n" \
14413  "\n" \
14414  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"services\");\n" \
14415  " buf_pos = buf_pos + lg_write;\n" \
14416  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"navOrganisation\");\n" \
14417  " buf_pos = buf_pos + lg_write;\n" \
14418  " }\n" \
14419  " else if (giv_svPJDC == pcTypeRef)\n" \
14420  " {\n" \
14421  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"navService\");\n" \
14422  " buf_pos = buf_pos + lg_write;\n" \
14423  "\n" \
14424  " for (i = aiRgParent; (i < (aiRgParent + aiNbParent) && giv_orPJDC != givtrPart[i].acTypeRefPart[0]); i++)\n" \
14425  " ;\n" \
14426  "\n" \
14427  " if ((aiRgParent + aiNbParent) != i)\n" \
14428  " {\n" \
14429  " lg_write = giv_ecrit_elements_nav(&buf_pos, &givtrPart[i]);\n" \
14430  " buf_pos = buf_pos + lg_write;\n" \
14431  " }\n" \
14432  "\n" \
14433  " lg_write = giv_ecrit_noeud_attr(buf_pos, \"equipe\", pcCleRef);\n" \
14434  " buf_pos = buf_pos + lg_write;\n" \
14435  "\n" \
14436  " for (i = aiRgParent; i < (aiRgParent + aiNbParent); i++)\n" \
14437  " {\n" \
14438  " if (giv_prPJDC == givtrPart[i].acTypeRefPart[0])\n" \
14439  " {\n" \
14440  " lg_write = giv_ecrit_elements_nav(&buf_pos, &givtrPart[i]);\n" \
14441  " buf_pos = buf_pos + lg_write;\n" \
14442  " }\n" \
14443  " }\n" \
14444  "\n" \
14445  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"equipe\");\n" \
14446  " buf_pos = buf_pos + lg_write;\n" \
14447  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"navService\");\n" \
14448  " buf_pos = buf_pos + lg_write;\n" \
14449  " }\n" \
14450  " else if (giv_cPJDC == pcTypeRef)\n" \
14451  " {\n" \
14452  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"navCabinet\");\n" \
14453  " buf_pos = buf_pos + lg_write;\n" \
14454  " lg_write = giv_ecrit_noeud_attr(buf_pos, \"equipe\", pcCleRef);\n" \
14455  " buf_pos = buf_pos + lg_write;\n" \
14456  "\n" \
14457  " for (i = aiRgParent; i < (aiRgParent + aiNbParent); i++)\n" \
14458  " {\n" \
14459  " lg_write = giv_ecrit_elements_nav(&buf_pos, &givtrPart[i]);\n" \
14460  " buf_pos = buf_pos + lg_write;\n" \
14461  " }\n" \
14462  "\n" \
14463  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"equipe\");\n" \
14464  " buf_pos = buf_pos + lg_write;\n" \
14465  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"navCabinet\");\n" \
14466  " buf_pos = buf_pos + lg_write;\n" \
14467  " }\n" \
14468  " else if ((giv_prPJDC == pcTypeRef) && (0 != giviNbParentPart))\n" \
14469  " {\n" \
14470  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"navMedecin\");\n" \
14471  " buf_pos = buf_pos + lg_write;\n" \
14472  "\n" \
14473  " for (i = aiRgParent; (i < (aiRgParent + aiNbParent) && giv_cPJDC != givtrPart[i].acTypeRefPart[0]); i++)\n" \
14474  " ;\n" \
14475  "\n" \
14476  " if ((aiRgParent + aiNbParent) != i)\n" \
14477  " {\n" \
14478  " lg_write = giv_ecrit_elements_nav(&buf_pos, &givtrPart[i]);\n" \
14479  " buf_pos = buf_pos + lg_write;\n" \
14480  " }\n" \
14481  " else\n" \
14482  " {\n" \
14483  " for (i = aiRgParent; (i < (aiRgParent + aiNbParent) && giv_orPJDC != givtrPart[i].acTypeRefPart[0]); i++)\n" \
14484  " ;\n" \
14485  "\n" \
14486  " if ((aiRgParent + aiNbParent) != i)\n" \
14487  " {\n" \
14488  " lg_write = giv_ecrit_elements_nav(&buf_pos, &givtrPart[i]);\n" \
14489  " buf_pos = buf_pos + lg_write;\n" \
14490  " }\n" \
14491  "\n" \
14492  " for (i = aiRgParent; (i < (aiRgParent + aiNbParent) && giv_svPJDC != givtrPart[i].acTypeRefPart[0]); i++)\n" \
14493  " ;\n" \
14494  "\n" \
14495  " if ((aiRgParent + aiNbParent) != i)\n" \
14496  " {\n" \
14497  " lg_write = giv_ecrit_elements_nav(&buf_pos, &givtrPart[i]);\n" \
14498  " buf_pos = buf_pos + lg_write;\n" \
14499  " }\n" \
14500  " }\n" \
14501  "\n" \
14502  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"navMedecin\");\n" \
14503  " buf_pos = buf_pos + lg_write;\n" \
14504  " }\n" \
14505  " else\n" \
14506  " GWTTrace(GWT_NIV_GRAVE, (\"WARNING : type de référence de partenaire erroné : <%c> epj <%s>\\n\", prPart->acTypeRefPart[0], prPart->acEtab));\n" \
14507  "\n" \
14508  " *buf_pos_in = buf_pos;\n" \
14509  " return (iCodRet);\n" \
14510  "}\n" \
14511  "\n" \
14512  "/*----Fonction----------------------------------------------------------------*/\n" \
14513  "/* */\n" \
14514  "/* Fonction : GIV_ecrit_denom_parent () */\n" \
14515  "/* */\n" \
14516  "/* But : ecrit denomination de parent de partenaire */\n" \
14517  "/* */\n" \
14518  "/* */\n" \
14519  "/* Entree(s) : un buffer, les differents codes */\n" \
14520  "/* */\n" \
14521  "/* Sortie(s) : OK ou KO */\n" \
14522  "/* */\n" \
14523  "/* Portable : Transparent */\n" \
14524  "/* */\n" \
14525  "/*----------------------------------------------------------------------------*/\n" \
14526  "\n" \
14527  "int4 giv_init_denom_parent(char* buf, char* apcEtab, int4* apiDeb)\n" \
14528  "{\n" \
14529  " int4 lg_ecr;\n" \
14530  " strcpy(buf, \"<intitulelibpjdc etab=\\\"\");\n" \
14531  " strcat(buf, apcEtab);\n" \
14532  " strcat(buf, \"\\\">\");\n" \
14533  " lg_ecr = strlen(buf);\n" \
14534  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14535  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14536  " *(buf + lg_ecr + 2) = '\\0';\n" \
14537  " lg_ecr = lg_ecr + 2;\n" \
14538  " *apiDeb = 0;\n" \
14539  " return (lg_ecr);\n" \
14540  "}\n" \
14541  "int4 GIV_ecrit_denom_parent(char* buf, char* aprDenom, char* aprPrenom, int4* apiDeb)\n" \
14542  "{\n" \
14543  " int4 iRet;\n" \
14544  " int4 lg_ecr = 0;\n" \
14545  "\n" \
14546  " if (0 == strlen(buf))\n" \
14547  " strcpy(buf, \"<\");\n" \
14548  " else\n" \
14549  " strcat(buf, \"<\");\n" \
14550  "\n" \
14551  " strcat(buf, \"denomlibpjdc\");\n" \
14552  " strcat(buf, \">\");\n" \
14553  " lg_ecr = strlen(buf);\n" \
14554  " iRet = giv_sortie_ISO(&buf, GIVfDescFicBloc);\n" \
14555  "\n" \
14556  " if (0 == strcmp(givtcInvDenPn, \"NON\"))\n" \
14557  " {\n" \
14558  " strcpy(buf_concat, aprDenom);\n" \
14559  "\n" \
14560  " if (0 != strlen(aprPrenom))\n" \
14561  " {\n" \
14562  " strcat(buf_concat, \" \");\n" \
14563  " strcat(buf_concat, aprPrenom);\n" \
14564  " }\n" \
14565  " }\n" \
14566  " else\n" \
14567  " {\n" \
14568  " /* inversion de l'ordre de la denomination-prénom */\n" \
14569  " if (0 != strlen(aprPrenom))\n" \
14570  " {\n" \
14571  " strcpy(buf_concat, aprPrenom);\n" \
14572  " strcat(buf_concat, \" \");\n" \
14573  " strcat(buf_concat, aprDenom);\n" \
14574  " }\n" \
14575  " else\n" \
14576  " strcpy(buf_concat, aprDenom);\n" \
14577  " }\n" \
14578  "\n" \
14579  " lg_ecr = giv_ecrit_balise_epj(&buf, buf_concat, \"\");\n" \
14580  " lg_ecr = giv_ecrit_fin_noeud(&buf, \"denomlibpjdc\");\n" \
14581  " buf = buf + lg_ecr;\n" \
14582  " return (lg_ecr);\n" \
14583  "}\n" \
14584  "\n" \
14585  "/*----Fonction----------------------------------------------------------------*/\n" \
14586  "/* */\n" \
14587  "/* Fonction : giv_ecrit_noeud_inscription () */\n" \
14588  "/* */\n" \
14589  "/* But : ecrit une inscription avec tous les champs */\n" \
14590  "/* */\n" \
14591  "/* */\n" \
14592  "/* Entree(s) : un buffer, numero, lo ls grp, seq */\n" \
14593  "/* */\n" \
14594  "/* Sortie(s) : OK ou KO */\n" \
14595  "/* */\n" \
14596  "/* Portable : Transparent */\n" \
14597  "/* */\n" \
14598  "/*----------------------------------------------------------------------------*/\n" \
14599  "\n" \
14600  "static int4 giv_ecrit_noeud_inscription(char* buf, GYBrDOCUMENTEpj* doc, int4 i)\n" \
14601  "{\n" \
14602  " int4 lg_ecr;\n" \
14603  " int4 iCodRet = (int4)GIV::GWCCodeOK;\n" \
14604  "\n" \
14605  " if (strlen(doc->value.inscription[i].val_num) > 0)\n" \
14606  " {\n" \
14607  " strcpy(buf, \"<\");\n" \
14608  " strcat(buf, \"inscription\");\n" \
14609  " strcat(buf, \" \");\n" \
14610  " strcat(buf, \"num\");\n" \
14611  " strcat(buf, \"=\");\n" \
14612  " strcat(buf, \"\\\"\");\n" \
14613  " strcat(buf, doc->value.inscription[i].val_num);\n" \
14614  " strcat(buf, \"\\\"\");\n" \
14615  " strcat(buf, \" \");\n" \
14616  " strcat(buf, \"lo\");\n" \
14617  " strcat(buf, \"=\");\n" \
14618  " strcat(buf, \"\\\"\");\n" \
14619  " iCodRet = GIVCodeClient(doc->value.inscription[i].val_lols, (int4)strlen(doc->value.inscription[i].val_lols));\n" \
14620  " strcat(buf, GIVtcClientDecode);\n" \
14621  " strcat(buf, \"\\\"\");\n" \
14622  " strcat(buf, \" \");\n" \
14623  " strcat(buf, \"ls\");\n" \
14624  " strcat(buf, \"=\");\n" \
14625  " strcat(buf, \"\\\"\");\n" \
14626  " strcat(buf, doc->value.inscription[i].val_lslo);\n" \
14627  " strcat(buf, \"\\\"\");\n" \
14628  "\n" \
14629  " if (strlen(doc->value.inscription[i].val_grp) > 0)\n" \
14630  " {\n" \
14631  " strcat(buf, \" \");\n" \
14632  " strcat(buf, \"grp\");\n" \
14633  " strcat(buf, \"=\");\n" \
14634  " strcat(buf, \"\\\"\");\n" \
14635  " iCodRet = GIVCodeClient(doc->value.inscription[i].val_grp, (int4)strlen(doc->value.inscription[i].val_grp));\n" \
14636  " strcat(buf, GIVtcClientDecode);\n" \
14637  " strcat(buf, \"\\\"\");\n" \
14638  " }\n" \
14639  " else\n" \
14640  " {\n" \
14641  " strcat(buf, \" \");\n" \
14642  " strcat(buf, \"grp\");\n" \
14643  " strcat(buf, \"=\");\n" \
14644  " strcat(buf, \"\\\"\");\n" \
14645  " strcat(buf, \"\\\"\");\n" \
14646  " }\n" \
14647  "\n" \
14648  " strcat(buf, \" \");\n" \
14649  " strcat(buf, \"seq\");\n" \
14650  " strcat(buf, \"=\");\n" \
14651  " strcat(buf, \"\\\"\");\n" \
14652  " strcat(buf, doc->value.inscription[i].val_seq);\n" \
14653  " strcat(buf, \"\\\"\");\n" \
14654  " strcat(buf, \">\");\n" \
14655  " } /* Fin if ins */\n" \
14656  " else\n" \
14657  " {\n" \
14658  " strcpy(buf, \"<\");\n" \
14659  " strcat(buf, \"inscription\");\n" \
14660  " strcat(buf, \">\");\n" \
14661  " }\n" \
14662  "\n" \
14663  " lg_ecr = strlen(buf);\n" \
14664  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14665  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14666  " *(buf + lg_ecr + 2) = '\\0';\n" \
14667  " return (lg_ecr + 2);\n" \
14668  "} /* Fin noeud inscription */\n" \
14669  "\n" \
14670  "/*----Fonction----------------------------------------------------------------*/\n" \
14671  "/* */\n" \
14672  "/* Fonction : giv_ecrit_noeud_objets_pub () */\n" \
14673  "/* */\n" \
14674  "/* But : ecrit les objets pub avec les champs fournis */\n" \
14675  "/* */\n" \
14676  "/* */\n" \
14677  "/* Entree(s) : un buffer, id, type, stype */\n" \
14678  "/* */\n" \
14679  "/* Sortie(s) : OK ou KO */\n" \
14680  "/* */\n" \
14681  "/* Portable : Transparent */\n" \
14682  "/* */\n" \
14683  "/*----------------------------------------------------------------------------*/\n" \
14684  "\n" \
14685  "static int4 giv_ecrit_noeud_objets_pub(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 aindice, char* pcCleTri)\n" \
14686  "{\n" \
14687  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
14688  " int4 lg_ecr_noyau = 0;\n" \
14689  " int4 lg_ecr_module = 0;\n" \
14690  " int4 lg_ecr_micro = 0;\n" \
14691  " int4 lg_ecr = 0;\n" \
14692  " int4 i, k, kk = 0;\n" \
14693  " int4 j, jk, jkk = 0;\n" \
14694  " char* buf;\n" \
14695  " int4 iRang, iObj;\n" \
14696  " GWTTrace(GWT_NIV_FONCT, (\" No_noyau : ... %d\\n\", nb_noyau));\n" \
14697  " GWTTrace(GWT_NIV_FONCT, (\" No_micro : ... %d\\n\", nb_micro));\n" \
14698  " GWTTrace(GWT_NIV_FONCT, (\" No_module : ... %d\\n\", nb_module));\n" \
14699  " /* Initialisation pointeur */\n" \
14700  " buf = *buf_pos_in;\n" \
14701  " iRang = -1;\n" \
14702  "\n" \
14703  " for (i = 0; i < givrListObj.iNbr; i++)\n" \
14704  " {\n" \
14705  " k = givrListObj.trEltRangListObj[i];\n" \
14706  " kk = givrListObj.trEltListObj[k].iRgLigne;\n" \
14707  " iObj = givrListObj.trEltListObj[k].iRgObj;\n" \
14708  "\n" \
14709  " if (iRang != givrListObj.trEltListObj[k].iRangTri)\n" \
14710  " {\n" \
14711  " iRang = givrListObj.trEltListObj[k].iRangTri;\n" \
14712  "\n" \
14713  " if (i == 0)\n" \
14714  " strcpy(buf, \"<\");\n" \
14715  " else\n" \
14716  " strcat(buf, \"<\");\n" \
14717  "\n" \
14718  " strcat(buf, \"objet\");\n" \
14719  " strcat(buf, \" \");\n" \
14720  " strcat(buf, \"id\");\n" \
14721  " strcat(buf, \"=\");\n" \
14722  " strcat(buf, \"\\\"\");\n" \
14723  " strcat(buf, (doc + kk)->value.objets_pub.micro[iObj].id);\n" \
14724  " strcat(buf, \"\\\"\");\n" \
14725  " strcat(buf, \" type=\");\n" \
14726  " strcat(buf, \"\\\"\");\n" \
14727  " strcat(buf, (doc + kk)->value.objets_pub.micro[iObj].type);\n" \
14728  " strcat(buf, \"\\\"\");\n" \
14729  " strcat(buf, \" stype=\");\n" \
14730  " strcat(buf, \"\\\"\");\n" \
14731  " strcat(buf, (doc + kk)->value.objets_pub.micro[iObj].stype);\n" \
14732  " strcat(buf, \"\\\"\");\n" \
14733  " strcat(buf, \" sstype=\");\n" \
14734  " strcat(buf, \"\\\"\");\n" \
14735  " strcat(buf, (doc + kk)->value.objets_pub.micro[iObj].sstype);\n" \
14736  " strcat(buf, \"\\\"\");\n" \
14737  " strcat(buf, \" dmaj=\");\n" \
14738  " strcat(buf, \"\\\"\");\n" \
14739  " strcat(buf, (doc + kk)->value.objets_pub.micro[iObj].tcdatact);\n" \
14740  " strcat(buf, \"\\\"\");\n" \
14741  " strcat(buf, \" onumcli=\");\n" \
14742  " strcat(buf, \"\\\"\");\n" \
14743  " strcat(buf, (doc + kk)->value.numero_client);\n" \
14744  " strcat(buf, \"\\\"\");\n" \
14745  "\n" \
14746  " for (j = 0; j < givrListObj.iNbr; j++)\n" \
14747  " {\n" \
14748  " jk = givrListObj.trEltRangListObj[j];\n" \
14749  " jkk = givrListObj.trEltListObj[jk].iRgLigne;\n" \
14750  "\n" \
14751  " if ((iRang == givrListObj.trEltListObj[jk].iRangTri) && (doc->value.intitule.iRgPrinc == jkk))\n" \
14752  " {\n" \
14753  " strcat(buf, \" obpal=\");\n" \
14754  " strcat(buf, \"\\\"\");\n" \
14755  " strcat(buf, \"true\");\n" \
14756  " strcat(buf, \"\\\"\");\n" \
14757  " break;\n" \
14758  " }\n" \
14759  " }\n" \
14760  "\n" \
14761  " strcat(buf, \"> </objet>\");\n" \
14762  "\n" \
14763  " if ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].type, \"M\")) && (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \" T\")))\n" \
14764  " {\n" \
14765  " /* module PJI trouvé */\n" \
14766  " (void)strcpy(pcCleTri, \"0\");\n" \
14767  " }\n" \
14768  "\n" \
14769  " lg_ecr = strlen(buf);\n" \
14770  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14771  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14772  " *(buf + lg_ecr + 2) = '\\0';\n" \
14773  " buf = buf + lg_ecr + 2;\n" \
14774  " }\n" \
14775  " }\n" \
14776  "\n" \
14777  " *buf_pos_in = buf;\n" \
14778  " return (iCodRet);\n" \
14779  "} /* Fin ecrire objets pub */\n" \
14780  "/*-----------------------------Fin de la fonction---------------*/\n" \
14781  "static int4 giv_ecrit_objet_pub(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 iDoc, int4 iObj, char* pcBalise)\n" \
14782  "{\n" \
14783  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
14784  " int4 lg_ecr = 0;\n" \
14785  " char* buf;\n" \
14786  " /* Initialisation pointeur */\n" \
14787  " buf = *buf_pos_in;\n" \
14788  " strcpy(buf, \"<\");\n" \
14789  " strcat(buf, pcBalise);\n" \
14790  " strcat(buf, \" \");\n" \
14791  " strcat(buf, \"id\");\n" \
14792  " strcat(buf, \"=\");\n" \
14793  " strcat(buf, \"\\\"\");\n" \
14794  " strcat(buf, (doc + iDoc)->value.objets_pub.micro[iObj].id);\n" \
14795  " strcat(buf, \"\\\"\");\n" \
14796  " strcat(buf, \" type=\");\n" \
14797  " strcat(buf, \"\\\"\");\n" \
14798  " strcat(buf, (doc + iDoc)->value.objets_pub.micro[iObj].type);\n" \
14799  " strcat(buf, \"\\\"\");\n" \
14800  " strcat(buf, \" stype=\");\n" \
14801  " strcat(buf, \"\\\"\");\n" \
14802  " strcat(buf, (doc + iDoc)->value.objets_pub.micro[iObj].stype);\n" \
14803  " strcat(buf, \"\\\"\");\n" \
14804  " strcat(buf, \" sstype=\");\n" \
14805  " strcat(buf, \"\\\"\");\n" \
14806  " strcat(buf, (doc + iDoc)->value.objets_pub.micro[iObj].sstype);\n" \
14807  " strcat(buf, \"\\\"\");\n" \
14808  " strcat(buf, \" onumcli=\");\n" \
14809  " strcat(buf, \"\\\"\");\n" \
14810  " strcat(buf, (doc + iDoc)->value.numero_client);\n" \
14811  " strcat(buf, \"\\\">\");\n" \
14812  "\n" \
14813  " if (!(0 == strcmp(\"objetpub\", pcBalise) && (((0 == strcmp(\"SC\", (doc + iDoc)->value.objets_pub.micro[iObj].stype)) && ((0 == strcmp(\"PV\", (doc + iDoc)->value.objets_pub.micro[iObj].sstype))\n" \
14814  " || (0 == strcmp(\"SR\", (doc + iDoc)->value.objets_pub.micro[iObj].sstype)))) || ((0 != strlen((doc + iDoc)->value.objets_pub.micro[iObj].stypcvi))\n" \
14815  " && (0 != strcmp(\"MO\", (doc + iDoc)->value.objets_pub.micro[iObj].stype))))))\n" \
14816  " {\n" \
14817  " strcat(buf, \" </\");\n" \
14818  " strcat(buf, pcBalise);\n" \
14819  " strcat(buf, \">\");\n" \
14820  " }\n" \
14821  "\n" \
14822  " lg_ecr = strlen(buf);\n" \
14823  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14824  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14825  " *(buf + lg_ecr + 2) = '\\0';\n" \
14826  " buf = buf + lg_ecr + 2;\n" \
14827  " *buf_pos_in = buf;\n" \
14828  " return (iCodRet);\n" \
14829  "} /* Fin ecrire objet pub */\n" \
14830  "\n" \
14831  "/*----Fonction----------------------------------------------------------------*/\n" \
14832  "/* */\n" \
14833  "/* Fonction : giv_ecrit_noeud_objets_pvi () */\n" \
14834  "/* */\n" \
14835  "/* But : ecrit les liens entre PVI et Video */\n" \
14836  "/* */\n" \
14837  "/* */\n" \
14838  "/* Entree(s) : un buffer, id, type, stype */\n" \
14839  "/* */\n" \
14840  "/* Sortie(s) : OK ou KO */\n" \
14841  "/* */\n" \
14842  "/* Portable : Transparent */\n" \
14843  "/* */\n" \
14844  "/*----------------------------------------------------------------------------*/\n" \
14845  "\n" \
14846  "static int4 giv_ecrit_noeud_objets_pvi(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 aindice)\n" \
14847  "{\n" \
14848  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
14849  " int4 lg_ecr = 0;\n" \
14850  " int4 i, k, j, l = 0;\n" \
14851  " char* buf;\n" \
14852  " int4 iRang, iObj, iLig;\n" \
14853  " int4 iVRang, iVObj, iVLig;\n" \
14854  " /* Initialisation pointeur */\n" \
14855  " buf = *buf_pos_in;\n" \
14856  " iRang = -1;\n" \
14857  "\n" \
14858  " for (i = 0; i < givrListObj.iNbr; i++)\n" \
14859  " {\n" \
14860  " k = givrListObj.trEltRangListObj[i];\n" \
14861  " iLig = givrListObj.trEltListObj[k].iRgLigne;\n" \
14862  " iObj = givrListObj.trEltListObj[k].iRgObj;\n" \
14863  "\n" \
14864  " if ((0 != strcmp((doc + iLig)->value.objets_pub.micro[iObj].stype, \"SC\")) || (0 != strcmp((doc + iLig)->value.objets_pub.micro[iObj].sstype, \"PV\")))\n" \
14865  " continue;\n" \
14866  "\n" \
14867  " for (j = 0; (j < givrListObj.iNbr && iRang != givrListObj.trEltListObj[k].iRangTri); j++)\n" \
14868  " {\n" \
14869  " if (-1 == givrListObj.trEltListObj[j].iOrdTri)\n" \
14870  " givrListObj.trEltListObj[j].iOrdTri = 0;\n" \
14871  " }\n" \
14872  "\n" \
14873  " iVRang = -1;\n" \
14874  "\n" \
14875  " for (j = 0; j < givrListObj.iNbr; j++)\n" \
14876  " {\n" \
14877  " l = givrListObj.trEltRangListObj[j];\n" \
14878  " iVLig = givrListObj.trEltListObj[l].iRgLigne;\n" \
14879  " iVObj = givrListObj.trEltListObj[l].iRgObj;\n" \
14880  "\n" \
14881  " if ((0 != strcmp((doc + iVLig)->value.objets_pub.micro[iVObj].stype, \"FI\")) && (0 != strcmp((doc + iVLig)->value.objets_pub.micro[iVObj].stype, \"IN\"))\n" \
14882  " && (0 != strcmp((doc + iVLig)->value.objets_pub.micro[iVObj].stype, \"VI\")))\n" \
14883  " {\n" \
14884  " iVRang = -1;\n" \
14885  " continue;\n" \
14886  " }\n" \
14887  "\n" \
14888  " GWTTrace(GWT_NIV_FONCT, (\" Tri objet : ... %d,%d,%d,%d,%d,%s,%s,%s,%s\\n\", j, l, givrListObj.trEltListObj[l].iRangTri, givrListObj.trEltListObj[l].iOrdTri, iVLig,\n" \
14889  " (doc + iVLig)->value.objets_pub.micro[iVObj].type, (doc + iVLig)->value.objets_pub.micro[iVObj].stype, (doc + iVLig)->value.objets_pub.micro[iVObj].sstype,\n" \
14890  " (doc + iVLig)->value.objets_pub.micro[iVObj].id));\n" \
14891  "\n" \
14892  " if ((iLig == iVLig) && (-1 != givrListObj.trEltListObj[givrListObj.trEltRangListObj[j - givrListObj.trEltListObj[l].iOrdTri]].iOrdTri))\n" \
14893  " {\n" \
14894  " /* association validée */\n" \
14895  " iVRang = givrListObj.trEltListObj[l].iRangTri;\n" \
14896  " givrListObj.trEltListObj[givrListObj.trEltRangListObj[j - givrListObj.trEltListObj[l].iOrdTri]].iOrdTri = -1;\n" \
14897  "\n" \
14898  " if (buf == *buf_pos_in)\n" \
14899  " {\n" \
14900  " lg_ecr = giv_ecrit_noeud_simple(buf, \"lienspvivideo\");\n" \
14901  " buf = buf + lg_ecr;\n" \
14902  " }\n" \
14903  "\n" \
14904  " lg_ecr = giv_ecrit_noeud_simple(buf, \"lienpvivideo\");\n" \
14905  " buf = buf + lg_ecr;\n" \
14906  " strcat(buf, \"<\");\n" \
14907  " strcat(buf, \"lienpvi\");\n" \
14908  " strcat(buf, \" \");\n" \
14909  " strcat(buf, \"id\");\n" \
14910  " strcat(buf, \"=\");\n" \
14911  " strcat(buf, \"\\\"\");\n" \
14912  " strcat(buf, (doc + iVLig)->value.objets_pub.micro[iVObj].id);\n" \
14913  " strcat(buf, \"\\\"\");\n" \
14914  " strcat(buf, \" type=\");\n" \
14915  " strcat(buf, \"\\\"\");\n" \
14916  " strcat(buf, (doc + iVLig)->value.objets_pub.micro[iVObj].type);\n" \
14917  " strcat(buf, \"\\\"\");\n" \
14918  " strcat(buf, \" stype=\");\n" \
14919  " strcat(buf, \"\\\"\");\n" \
14920  " strcat(buf, (doc + iVLig)->value.objets_pub.micro[iVObj].stype);\n" \
14921  " strcat(buf, \"\\\"\");\n" \
14922  " strcat(buf, \" sstype=\");\n" \
14923  " strcat(buf, \"\\\"\");\n" \
14924  " strcat(buf, (doc + iVLig)->value.objets_pub.micro[iVObj].sstype);\n" \
14925  " strcat(buf, \"\\\"\");\n" \
14926  " strcat(buf, \" dmaj=\");\n" \
14927  " strcat(buf, \"\\\"\");\n" \
14928  " strcat(buf, (doc + iVLig)->value.objets_pub.micro[iVObj].tcdatact);\n" \
14929  " strcat(buf, \"\\\"\");\n" \
14930  " strcat(buf, \"> </lienpvi>\");\n" \
14931  " lg_ecr = strlen(buf);\n" \
14932  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14933  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14934  " *(buf + lg_ecr + 2) = '\\0';\n" \
14935  " buf = buf + lg_ecr + 2;\n" \
14936  " strcat(buf, \"<\");\n" \
14937  " strcat(buf, \"lienvideo\");\n" \
14938  " strcat(buf, \" \");\n" \
14939  " strcat(buf, \"id\");\n" \
14940  " strcat(buf, \"=\");\n" \
14941  " strcat(buf, \"\\\"\");\n" \
14942  " strcat(buf, (doc + iLig)->value.objets_pub.micro[iObj].id);\n" \
14943  " strcat(buf, \"\\\"\");\n" \
14944  " strcat(buf, \" type=\");\n" \
14945  " strcat(buf, \"\\\"\");\n" \
14946  " strcat(buf, (doc + iLig)->value.objets_pub.micro[iObj].type);\n" \
14947  " strcat(buf, \"\\\"\");\n" \
14948  " strcat(buf, \" stype=\");\n" \
14949  " strcat(buf, \"\\\"\");\n" \
14950  " strcat(buf, (doc + iLig)->value.objets_pub.micro[iObj].stype);\n" \
14951  " strcat(buf, \"\\\"\");\n" \
14952  " strcat(buf, \" sstype=\");\n" \
14953  " strcat(buf, \"\\\"\");\n" \
14954  " strcat(buf, (doc + iLig)->value.objets_pub.micro[iObj].sstype);\n" \
14955  " strcat(buf, \"\\\"\");\n" \
14956  " strcat(buf, \" dmaj=\");\n" \
14957  " strcat(buf, \"\\\"\");\n" \
14958  " strcat(buf, (doc + iLig)->value.objets_pub.micro[iObj].tcdatact);\n" \
14959  " strcat(buf, \"\\\"\");\n" \
14960  " strcat(buf, \"> </lienvideo>\");\n" \
14961  " lg_ecr = strlen(buf);\n" \
14962  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
14963  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
14964  " *(buf + lg_ecr + 2) = '\\0';\n" \
14965  " buf = buf + lg_ecr + 2;\n" \
14966  " lg_ecr = giv_ecrit_fin_noeud(&buf, \"lienpvivideo\");\n" \
14967  " buf = buf + lg_ecr;\n" \
14968  " }\n" \
14969  " else\n" \
14970  " {\n" \
14971  " if (iLig == iVLig)\n" \
14972  " {\n" \
14973  " /* association déjà traitée */\n" \
14974  " GWTTrace(GWT_NIV_FONCT, (\" Tri objet déjà traité : ... %d,%d,%s\\n\", j - givrListObj.trEltListObj[l].iOrdTri,\n" \
14975  " givrListObj.trEltListObj[givrListObj.trEltRangListObj[j - givrListObj.trEltListObj[l].iOrdTri]].iOrdTri,\n" \
14976  " (doc + givrListObj.trEltListObj[givrListObj.trEltRangListObj[j - givrListObj.trEltListObj[l].iOrdTri]].iRgLigne)->value.objets_pub.micro[givrListObj.trEltListObj[givrListObj.trEltRangListObj[j -\n" \
14977  " givrListObj.trEltListObj[l].iOrdTri]].iRgObj].id));\n" \
14978  " }\n" \
14979  "\n" \
14980  " iVRang = -1;\n" \
14981  " }\n" \
14982  " }\n" \
14983  "\n" \
14984  " iRang = givrListObj.trEltListObj[k].iRangTri;\n" \
14985  " }\n" \
14986  "\n" \
14987  " if (buf != *buf_pos_in)\n" \
14988  " {\n" \
14989  " lg_ecr = giv_ecrit_fin_noeud(&buf, \"lienspvivideo\");\n" \
14990  " buf = buf + lg_ecr;\n" \
14991  " }\n" \
14992  "\n" \
14993  " *buf_pos_in = buf;\n" \
14994  " return (iCodRet);\n" \
14995  "} /* Fin ecrire objets pvi */\n" \
14996  "\n" \
14997  "/*----Fonction----------------------------------------------------------------*/\n" \
14998  "/* */\n" \
14999  "/* Fonction : giv_ecrit_noeud_objets_url () */\n" \
15000  "/* */\n" \
15001  "/* But : ecrit les libellés d'URL */\n" \
15002  "/* */\n" \
15003  "/* */\n" \
15004  "/* Entree(s) : un buffer, id, type, stype */\n" \
15005  "/* */\n" \
15006  "/* Sortie(s) : OK ou KO */\n" \
15007  "/* */\n" \
15008  "/* Portable : Transparent */\n" \
15009  "/* */\n" \
15010  "/*----------------------------------------------------------------------------*/\n" \
15011  "\n" \
15012  "static int4 giv_ecrit_noeud_objets_url(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 aindice)\n" \
15013  "{\n" \
15014  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
15015  " int4 lg_ecr = 0;\n" \
15016  " int4 x, i, j, k, kk = 0;\n" \
15017  " char* buf;\n" \
15018  " int4 iRang, iObj;\n" \
15019  " int4 iLg = 0;\n" \
15020  " int4 iIntRet;\n" \
15021  " GYBrIamicT rIamic;\n" \
15022  " GYBrIndIamicT rIndIamic;\n" \
15023  " GYBrIapartT rIapart;\n" \
15024  " /* Initialisation pointeur */\n" \
15025  " buf = *buf_pos_in;\n" \
15026  " iRang = -1;\n" \
15027  " buf_concat[0] = '\\0';\n" \
15028  "\n" \
15029  " for (i = 0; i < givrListObj.iNbr; i++)\n" \
15030  " {\n" \
15031  " iIntRet = (int4)GIV::GIXCodeKO;\n" \
15032  " buf_concat[0] = '\\0';\n" \
15033  " k = givrListObj.trEltRangListObj[i];\n" \
15034  " kk = givrListObj.trEltListObj[k].iRgLigne;\n" \
15035  " iObj = givrListObj.trEltListObj[k].iRgObj;\n" \
15036  "\n" \
15037  " if (iRang != givrListObj.trEltListObj[k].iRangTri)\n" \
15038  " {\n" \
15039  " iRang = givrListObj.trEltListObj[k].iRangTri;\n" \
15040  "\n" \
15041  " if (((doc + kk)->value.objets_pub.micro[iObj].type[0] == 'X') && ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \" U\"))\n" \
15042  " || ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"SC\")) && (0 != strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"PV\")))\n" \
15043  " || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"SO\")) || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LC\"))\n" \
15044  " || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LD\")) || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LP\"))\n" \
15045  " || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LR\")) || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LE\"))\n" \
15046  " || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LF\")) || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LT\"))\n" \
15047  " || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LB\"))))\n" \
15048  " {\n" \
15049  " (void)strcpy(rIamic.acNumobj, (doc + kk)->value.objets_pub.micro[iObj].id);\n" \
15050  " (void)strcpy(rIamic.acTypobj, \"M\");\n" \
15051  " /* utilisation du sous-type interne */\n" \
15052  " (void)strcpy(rIamic.acTpdsob, (doc + kk)->value.objets_pub.micro[iObj].stypint);\n" \
15053  " GWTTrace(GWT_NIV_FONCT, (\" type_micro : ... %s,%s,%s\\n\", (doc + kk)->value.objets_pub.micro[iObj].type, (doc + kk)->value.objets_pub.micro[iObj].stype,\n" \
15054  " (doc + kk)->value.objets_pub.micro[iObj].stypint));\n" \
15055  "\n" \
15056  " if ((0 != strlen((doc + kk)->value.objets_pub.libUrlGCpt)) && (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \" U\"))\n" \
15057  " && ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"PV\")) || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"SR\"))))\n" \
15058  " {\n" \
15059  " (void)strcpy(buf_concat, (doc + kk)->value.objets_pub.libUrlGCpt);\n" \
15060  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
15061  " }\n" \
15062  " else if ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LP\") && 0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"CR\"))\n" \
15063  " || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LR\") && 0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"LG\"))\n" \
15064  " || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LC\") && 0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"CH\")))\n" \
15065  " {\n" \
15066  " /* remplacement par l'url EPJ */\n" \
15067  " if (0 != strlen((doc + kk)->value.objets_pub.micro[iObj].valeur))\n" \
15068  " {\n" \
15069  " (void)strcpy(buf_concat, (doc + kk)->value.objets_pub.micro[iObj].valeur);\n" \
15070  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
15071  " }\n" \
15072  " }\n" \
15073  " else\n" \
15074  " iIntRet = givLectureTypeURL(&rIamic, &rIndIamic);\n" \
15075  "\n" \
15076  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
15077  " {\n" \
15078  " if ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"SC\")) && (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"PB\")))\n" \
15079  " {\n" \
15080  " /* pas de remplacement de l'url EPJ par l'url site présence */\n" \
15081  " /* (void)strcpy((doc+kk)->value.objets_pub.libUrlSite,buf_concat); */\n" \
15082  " }\n" \
15083  "\n" \
15084  " if (*buf_pos_in == buf)\n" \
15085  " strcpy(buf, \"<\");\n" \
15086  " else\n" \
15087  " strcat(buf, \"<\");\n" \
15088  "\n" \
15089  " strcat(buf, \"lienurl\");\n" \
15090  " strcat(buf, \" \");\n" \
15091  " strcat(buf, \"ct\");\n" \
15092  " strcat(buf, \"=\");\n" \
15093  " strcat(buf, \"\\\"\");\n" \
15094  " strcat(buf, buf_concat);\n" \
15095  " strcat(buf, \"\\\"\");\n" \
15096  " strcat(buf, \" typ_lienurl=\");\n" \
15097  " strcat(buf, \"\\\"\");\n" \
15098  "\n" \
15099  " /* HAL, OA12 : on prend le sous-type dans l'inscription car il n'est pas toujours connu dans PemicURL */\n" \
15100  " if ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"SR\")) && (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \" U\")))\n" \
15101  " strcat(buf, &(doc + kk)->value.objets_pub.micro[iObj].stype[1]);\n" \
15102  " else if ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"SR\")) && ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"SC\"))\n" \
15103  " || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"SO\"))))\n" \
15104  " strcat(buf, (doc + kk)->value.objets_pub.micro[iObj].stype);\n" \
15105  "\n" \
15106  " strcat(buf, (doc + kk)->value.objets_pub.micro[iObj].sstype);\n" \
15107  " strcat(buf, \"\\\"\");\n" \
15108  " strcat(buf, \" id=\");\n" \
15109  " strcat(buf, \"\\\"\");\n" \
15110  " strcat(buf, (doc + kk)->value.objets_pub.micro[iObj].id);\n" \
15111  " strcat(buf, \"\\\"\");\n" \
15112  " strcat(buf, \"> </lienurl>\");\n" \
15113  " lg_ecr = strlen(buf);\n" \
15114  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
15115  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
15116  " *(buf + lg_ecr + 2) = '\\0';\n" \
15117  " buf_concat[0] = '\\0';\n" \
15118  " buf = buf + lg_ecr + 2;\n" \
15119  " }\n" \
15120  " }\n" \
15121  " }\n" \
15122  " }\n" \
15123  "\n" \
15124  " for (i = 0; i < aindice; i++)\n" \
15125  " {\n" \
15126  " for (j = 0; j < (doc + i)->value.a_classer.iNbPart; j++)\n" \
15127  " {\n" \
15128  " iLg = strlen((doc + i)->value.a_classer.trpart[j].rpart) - 4;\n" \
15129  " (void)strcpy(rIapart.acOriPart, &(doc + i)->value.a_classer.trpart[j].rpart[iLg]);\n" \
15130  " memcpy(rIapart.acRefPart, (doc + i)->value.a_classer.trpart[j].rpart, iLg);\n" \
15131  " rIapart.acRefPart[iLg] = '\\0';\n" \
15132  "\n" \
15133  " if ((0 == strcmp(rIapart.acOriPart, giv_PJDC)) && (GIV::GIXCodeOK == (doc + i)->value.a_classer.trpart[j].iForPJDC) && (0 != strlen((doc + i)->value.a_classer.etab)))\n" \
15134  " {\n" \
15135  " /* ajout pour forçage LP-CR pour PJDC */\n" \
15136  " strcat(buf, \"<lienurl\");\n" \
15137  " strcat(buf, \" \");\n" \
15138  " strcat(buf, \"ct\");\n" \
15139  " strcat(buf, \"=\");\n" \
15140  " strcat(buf, \"\\\"\");\n" \
15141  " iLg = strlen(rIapart.acRefPart);\n" \
15142  "\n" \
15143  " for (x = 0; (x < iLg && 0 != isdigit(rIapart.acRefPart[x])); x++)\n" \
15144  " ;\n" \
15145  "\n" \
15146  " if (x < iLg)\n" \
15147  " rIapart.acRefPart[x] = '\\0';\n" \
15148  "\n" \
15149  " strcat(buf, rIapart.acRefPart);\n" \
15150  " strcat(buf, \"\\\"\");\n" \
15151  " strcat(buf, \" typ_lienurl=\");\n" \
15152  " strcat(buf, \"\\\"\");\n" \
15153  " strcat(buf, giv_ssPJDC);\n" \
15154  " strcat(buf, \"\\\"\");\n" \
15155  " strcat(buf, \" id=\");\n" \
15156  " strcat(buf, \"\\\"\");\n" \
15157  " strcat(buf, \"0002\");\n" \
15158  " strcat(buf, (doc + i)->value.a_classer.etab);\n" \
15159  " strcat(buf, \"0001\");\n" \
15160  " strcat(buf, \"\\\"\");\n" \
15161  " strcat(buf, \"> </lienurl>\");\n" \
15162  " lg_ecr = strlen(buf);\n" \
15163  " *(buf + lg_ecr) = SEPARE_LIGNE;\n" \
15164  " *(buf + lg_ecr + 1) = LINE_FEED;\n" \
15165  " *(buf + lg_ecr + 2) = '\\0';\n" \
15166  " }\n" \
15167  " }\n" \
15168  " }\n" \
15169  "\n" \
15170  " *buf_pos_in = buf;\n" \
15171  " return (iCodRet);\n" \
15172  "} /* Fin ecrire objets url */\n" \
15173  "\n" \
15174  "/* giv_ecrit_tabIeBloc : inserer le resultat dans la table de blocs ou supprimer une ligne de la table ou enfin mettre à jour plusieurs lignes\n" \
15175  " --------------------------------------------------------------------------------------------------------------------------------*/\n" \
15176  "static int4 giv_ecrit_tabIeBloc(GYBrDOCUMENTEpj* doc)\n" \
15177  "{\n" \
15178  " EXEC SQL\n" \
15179  " begin declare\n" \
15180  " section;\n" \
15181  " GYBrBlocT BlocLocal;\n" \
15182  " int2 indicatrice_acNogrou;\n" \
15183  " int2 indicatrice_acNoselo;\n" \
15184  " int2 indicatrice_acNosels;\n" \
15185  " int2 indicatrice_acEtab;\n" \
15186  " char tcEtab[GYBIeinscLgEtab2]; /* etab */\n" \
15187  " char tcRequete[800];\n" \
15188  " char* pcVersion = NULL;\n" \
15189  " EXEC SQL\n" \
15190  " end declare\n" \
15191  " section;\n" \
15192  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
15193  " int4 iCodRet = (int4)GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
15194  " int4 iIntRet = (int4)GIV::GWCCodeOK; /* Code retour des appels internes */\n" \
15195  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
15196  " time_t date;\n" \
15197  " date = time(NULL);\n" \
15198  " (void)strftime(BlocLocal.acDatemodbloc, sizeof(BlocLocal.acDatemodbloc), \"%Y%m%d\", localtime(&date));\n" \
15199  " strcpy(BlocLocal.acDepart, GIXcDepartement);\n" \
15200  " /* version du bloc */\n" \
15201  " pcVersion = strchr(pcVersionInsFour[0], (char)'.');\n" \
15202  " pcVersion++;\n" \
15203  "\n" \
15204  " if (0 == strlen(doc->value.a_classer.etab_dc))\n" \
15205  " indicatrice_acEtab = (int2) - 1;\n" \
15206  " else\n" \
15207  " {\n" \
15208  " indicatrice_acEtab = (int2)0;\n" \
15209  " strcpy(tcEtab, doc->value.a_classer.etab_dc);\n" \
15210  " }\n" \
15211  "\n" \
15212  " if (0 != strcmp(GIVtcGeneIeBloc, \"OUI\"))\n" \
15213  " {\n" \
15214  " /* Sortie de la fonction */\n" \
15215  " return (iCodRet);\n" \
15216  " }\n" \
15217  "\n" \
15218  " GWTTrace(GWT_NIV_FONCT, (\"TABLE BLOCS DE PARUTIONS ...\\n\"));\n" \
15219  " strcpy(BlocLocal.acNumnat, doc->value.inscription[0].val_num);\n" \
15220  " strcpy(BlocLocal.acNumlo, doc->value.inscription[0].val_lo);\n" \
15221  " strcpy(BlocLocal.acNumls, doc->value.inscription[0].val_ls);\n" \
15222  " strcpy(BlocLocal.acNogrou, doc->value.inscription[0].val_grp);\n" \
15223  " strcpy(BlocLocal.acNoselo, doc->value.inscription[0].val_seqLO);\n" \
15224  " strcpy(BlocLocal.acNosels, doc->value.inscription[0].val_seqLS);\n" \
15225  " strcpy(BlocLocal.acBlocid, nom_bloc_ref);\n" \
15226  " /* dump des données en cours de traitement */\n" \
15227  " /* pour investigation en cas de plantage dur */\n" \
15228  " GWTTrace(GWT_NIV_FONCT, (\"Depart=%s,Numnat=%s,Numlo=%s,Numls=%s,Blocid=%s,Nogrou=%s,Noselo=%s,Nosels=%s,Datemodbloc=%s\\n\", BlocLocal.acDepart, BlocLocal.acNumnat, BlocLocal.acNumlo, BlocLocal.acNumls,\n" \
15229  " BlocLocal.acBlocid, BlocLocal.acNogrou, BlocLocal.acNoselo, BlocLocal.acNosels, BlocLocal.acDatemodbloc));\n" \
15230  "\n" \
15231  " if ((int4)GIV::GWCCodeOK != iDejaPrepare)\n" \
15232  " {\n" \
15233  " (void)sprintf(tcRequete, GIV_CRE_IS, GIXcNomDest);\n" \
15234  " EXEC SQL\n" \
15235  " prepare rqtCre\n" \
15236  " from: tcRequete;\n" \
15237  " (void)sprintf(tcRequete, GIV_CRE_IG, GIXcNomDest);\n" \
15238  " EXEC SQL\n" \
15239  " prepare rqtCreG\n" \
15240  " from: tcRequete;\n" \
15241  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
15242  " }\n" \
15243  "\n" \
15244  " if (0 == strlen(BlocLocal.acNogrou))\n" \
15245  " {\n" \
15246  " indicatrice_acNogrou = (int2) - 1;\n" \
15247  " indicatrice_acNoselo = (int2) - 1;\n" \
15248  " indicatrice_acNosels = (int2) - 1;\n" \
15249  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Insert IS GYTtabIeBloc\");\n" \
15250  " EXEC SQL\n" \
15251  " execute rqtCre\n" \
15252  " using\n" \
15253  " :BlocLocal.acDepart,\n" \
15254  " :BlocLocal.acNumnat,\n" \
15255  " :BlocLocal.acNumlo,\n" \
15256  " :BlocLocal.acNumls,\n" \
15257  " :BlocLocal.acBlocid,\n" \
15258  " :tcEtab:indicatrice_acEtab,\n" \
15259  " :BlocLocal.acNogrou:indicatrice_acNogrou,\n" \
15260  " :BlocLocal.acNoselo:indicatrice_acNoselo,\n" \
15261  " :BlocLocal.acNosels:indicatrice_acNosels,\n" \
15262  " :BlocLocal.acDatemodbloc,\n" \
15263  " :pcVersion;\n" \
15264  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
15265  "\n" \
15266  " /* Analyse du code resultat SQL */\n" \
15267  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
15268  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acOrdre_sql));\n" \
15269  " }\n" \
15270  " else\n" \
15271  " {\n" \
15272  " indicatrice_acNogrou = (int2)0;\n" \
15273  " indicatrice_acNoselo = (int2)0;\n" \
15274  " indicatrice_acNosels = (int2)0;\n" \
15275  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Insert IM GYTtabIeBloc\");\n" \
15276  " EXEC SQL\n" \
15277  " execute rqtCreG\n" \
15278  " using\n" \
15279  " :BlocLocal.acDepart,\n" \
15280  " :BlocLocal.acNumnat,\n" \
15281  " :BlocLocal.acNumlo,\n" \
15282  " :BlocLocal.acNumls,\n" \
15283  " :BlocLocal.acBlocid,\n" \
15284  " :tcEtab:indicatrice_acEtab,\n" \
15285  " :BlocLocal.acNogrou:indicatrice_acNogrou,\n" \
15286  " :BlocLocal.acNoselo:indicatrice_acNoselo,\n" \
15287  " :BlocLocal.acNosels:indicatrice_acNosels,\n" \
15288  " :BlocLocal.acDatemodbloc,\n" \
15289  " :pcVersion;\n" \
15290  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
15291  "\n" \
15292  " /* Analyse du code resultat SQL */\n" \
15293  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
15294  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acOrdre_sql));\n" \
15295  " }\n" \
15296  "\n" \
15297  " return (iCodRet);\n" \
15298  "}\n" \
15299  "\n" \
15300  "/*-----------------------------Fin de la fonction---------------*/\n" \
15301  "\n" \
15302  "/*----Fonction----------------------------------------------------------------*/\n" \
15303  "/* */\n" \
15304  "/* Fonction : givInitConfGXX */\n" \
15305  "/* */\n" \
15306  "/* But : lesture de la configuration externe CG */\n" \
15307  "/* */\n" \
15308  "/* Entree(s) : néant */\n" \
15309  "/* */\n" \
15310  "/* Sortie(s) : néant */\n" \
15311  "/* */\n" \
15312  "/*----------------------------------------------------------------------------*/\n" \
15313  "\n" \
15314  "static void givInitConfGXX()\n" \
15315  "{\n" \
15316  " int4 iIntRet = (int4)GIV::GWCCodeOK;\n" \
15317  " char nom_test[50 + 1]; /* Nom du test */\n" \
15318  " char conf[50];\n" \
15319  " int4 i;\n" \
15320  " /* constitution du nom du fichier Bloc */\n" \
15321  " (void)sprintf(conf, \"%s_%s_%s\", \"GIV_PATH_BLOC\", GIXcNomDest, GIXcDepartement);\n" \
15322  " iIntRet = GWTLireConf(conf, givcCheminBloc);\n" \
15323  "\n" \
15324  " if (GIV::GWTok != iIntRet)\n" \
15325  " {\n" \
15326  " (void)strcpy(givcCheminBloc, \"/DATA/DEPT/CD2G\");\n" \
15327  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de Path des Blocs dans la conf. Valeur par defaut <%s> prise \\n\", givcCheminBloc));\n" \
15328  " }\n" \
15329  "\n" \
15330  " (void)sprintf(conf, \"%s_%s_%s\", \"GIV_REPERTOIRE\", GIXcNomDest, GIXcDepartement);\n" \
15331  " iIntRet = GWTLireConf(conf, givcRepertoire);\n" \
15332  "\n" \
15333  " if (GIV::GWTok != iIntRet)\n" \
15334  " {\n" \
15335  " (void)strcpy(givcRepertoire, GIXcDepartement);\n" \
15336  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de répertoire de Blocs dans la conf. Valeur par defaut <%s> prise \\n\", GIXcDepartement));\n" \
15337  " }\n" \
15338  "\n" \
15339  " /* Lecture variable d'environnement : nom du test */\n" \
15340  " memset(nom_test, 0, sizeof(nom_test));\n" \
15341  " iIntRet = GWTLireConf(\"GIV_NOM_TEST_XML\", nom_test);\n" \
15342  " /* Lecture variable d'environnement : caractère remplacement 'espace' du sous-type */\n" \
15343  " memset(remplace_espace, 0, sizeof(remplace_espace));\n" \
15344  " remplace_espace[0] = ' ';\n" \
15345  " iIntRet = GWTLireConf(\"GIV_REMPLACE_ESPACE_SOUS_TYPE\", remplace_espace);\n" \
15346  "\n" \
15347  " /* taille limite du fichier de sortie */\n" \
15348  " if ((0 == strcmp(GIXcValUrg, GWZUrgent)) && (0 != strcmp(givRecreerCD, GIXcNomIntf)))\n" \
15349  " (void)sprintf(conf, \"%s_%s\", \"GIV_TAILLE_FICHIER_URJ\", GIXcNomDest);\n" \
15350  " else\n" \
15351  " (void)sprintf(conf, \"%s_%s\", \"GIV_TAILLE_FICHIER_XML\", GIXcNomDest);\n" \
15352  "\n" \
15353  " if (0 != GWTLireConfNum(conf, &giviNbBlocs))\n" \
15354  " giviNbBlocs = -1;\n" \
15355  "\n" \
15356  " GWTTrace(GWT_NIV_FONCT, (\"Taille fichier XML en blocs : %8d\\n\", giviNbBlocs));\n" \
15357  " /* Lecture variable d'environnement : chemin SGIPRO */\n" \
15358  " memset(givtcRepSgiPro, 0, sizeof(givtcRepSgiPro));\n" \
15359  " /* constitution du nom du fichier Bloc */\n" \
15360  " (void)sprintf(conf, \"%s\", \"GIV_PATHCONTENU\");\n" \
15361  " iIntRet = GWTLireConf(conf, givtcRepSgiPro);\n" \
15362  "\n" \
15363  " if (GIV::GWTok != iIntRet)\n" \
15364  " {\n" \
15365  " (void)strcpy(givtcRepSgiPro, \"/fast/SGIPRO\");\n" \
15366  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de Path des fichiers SGIPRO dans la conf. Valeur par defaut <%s> prise \\n\", givtcRepSgiPro));\n" \
15367  " }\n" \
15368  "\n" \
15369  " /* Lecture variable d'environnement : chemin MPG */\n" \
15370  " memset(givtcRepMpg, 0, sizeof(givtcRepMpg));\n" \
15371  " /* constitution du nom du fichier MPG */\n" \
15372  " (void)sprintf(conf, \"%s\", \"GIV_PATH_MPG\");\n" \
15373  " iIntRet = GWTLireConf(conf, givtcRepMpg);\n" \
15374  "\n" \
15375  " if (GIV::GWTok != iIntRet)\n" \
15376  " {\n" \
15377  " (void)strcpy(givtcRepMpg, \"/DATA/DEPT/CD2G/888\");\n" \
15378  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de Path des fichiers SGIPRO dans la conf. Valeur par defaut <%s> prise \\n\", givtcRepMpg));\n" \
15379  " }\n" \
15380  "\n" \
15381  " iIntRet = GWTLireConf(\"GIV_VERS_DOC_EPJ\", givtcVersDoc);\n" \
15382  "\n" \
15383  " if (GIV::GWTok != iIntRet)\n" \
15384  " givtcVersDoc[0] = '\\0';\n" \
15385  "\n" \
15386  " /* Lecture variable d'environnement : paru loc arr intallation */\n" \
15387  " memset(givtcLocArrInst, 0, sizeof(givtcLocArrInst));\n" \
15388  " (void)sprintf(conf, \"%s_%s\", \"GIV_PARU_ARR_INST\", GIXcNomDest);\n" \
15389  " iIntRet = GWTLireConf(conf, givtcLocArrInst);\n" \
15390  "\n" \
15391  " if (GIV::GWTok != iIntRet)\n" \
15392  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de paru loc arr intallation dans la conf \\n\"));\n" \
15393  " else\n" \
15394  " {\n" \
15395  " for (i = 0; i < 3; i++)\n" \
15396  " {\n" \
15397  " /* parution sur arrondissement d'installation */\n" \
15398  " strcpy(buf_concat, givtrRefArr[i].dep);\n" \
15399  " strcat(buf_concat, givtrRefArr[i].loc);\n" \
15400  "\n" \
15401  " if (NULL != strstr(givtcLocArrInst, buf_concat))\n" \
15402  " givtrRefArr[i].iParuInst = (int4)GIV::GIXCodeOK;\n" \
15403  " }\n" \
15404  " }\n" \
15405  "\n" \
15406  " /* Lecture variable d'environnement : regions CECI */\n" \
15407  " memset(givtcRegCECI, 0, sizeof(givtcRegCECI));\n" \
15408  " (void)sprintf(conf, \"%s_%s\", \"GIV_REGION_CECI\", GIXcNomDest);\n" \
15409  " iIntRet = GWTLireConf(conf, givtcRegCECI);\n" \
15410  "\n" \
15411  " if (GIV::GWTok != iIntRet)\n" \
15412  " (void)strcpy(givtcRegCECI, \"NON\");\n" \
15413  "\n" \
15414  " GWTTrace(GWT_NIV_FONCT, (\"Regions CECI %s \\n\", givtcRegCECI));\n" \
15415  " /* Lecture variable d'environnement : liste objets contenu */\n" \
15416  " memset(givtcObjCont, 0, sizeof(givtcObjCont));\n" \
15417  " /* constitution du nom du fichier Bloc */\n" \
15418  " (void)sprintf(conf, \"%s_%s\", \"GIV_OBJETS_CONTENU\", GIXcNomDest);\n" \
15419  " iIntRet = GWTLireConf(conf, givtcObjCont);\n" \
15420  "\n" \
15421  " if (GIV::GWTok != iIntRet)\n" \
15422  " {\n" \
15423  " (void)strcpy(givtcObjCont, \"\");\n" \
15424  " GWTTrace(GWT_NIV_BIZAR, (\"Pas d'objet contenu dans la conf \\n\"));\n" \
15425  " }\n" \
15426  "\n" \
15427  " memset(givtcPrioCont, 0, sizeof(givtcPrioCont));\n" \
15428  " /* constitution du nom du fichier Bloc */\n" \
15429  " (void)sprintf(conf, \"%s_%s\", \"GIV_PRIORITE_CONTENU\", GIXcNomDest);\n" \
15430  " iIntRet = GWTLireConf(conf, givtcPrioCont);\n" \
15431  "\n" \
15432  " if (GIV::GWTok != iIntRet)\n" \
15433  " {\n" \
15434  " (void)strcpy(givtcPrioCont, \"\");\n" \
15435  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de priorité des contenus dans la conf \\n\"));\n" \
15436  " }\n" \
15437  "\n" \
15438  " memset(givtcExceptCont, 0, sizeof(givtcExceptCont));\n" \
15439  " (void)sprintf(conf, \"%s_%s\", \"GIV_CRC_EXCEPT\", GIXcNomDest);\n" \
15440  " iIntRet = GWTLireConf(conf, givtcExceptCont);\n" \
15441  "\n" \
15442  " if (GIV::GWTok != iIntRet)\n" \
15443  " {\n" \
15444  " (void)strcpy(givtcExceptCont, \"\");\n" \
15445  " GWTTrace(GWT_NIV_BIZAR, (\"Pas d'exception sur les contenus dans la conf \\n\"));\n" \
15446  " }\n" \
15447  "\n" \
15448  " /* Lecture variable d'environnement : liste partenaires à éliminer */\n" \
15449  " memset(givtcFourPart, 0, sizeof(givtcFourPart));\n" \
15450  " /* constitution du nom de paramètre */\n" \
15451  " (void)sprintf(conf, \"%s_%s\", \"GIV_NON_PARU_PART\", GIXcNomDest);\n" \
15452  " iIntRet = GWTLireConf(conf, givtcFourPart);\n" \
15453  "\n" \
15454  " if (GIV::GWTok != iIntRet)\n" \
15455  " {\n" \
15456  " (void)strcpy(givtcFourPart, \"\");\n" \
15457  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de partenaire à éliminer \\n\"));\n" \
15458  " }\n" \
15459  "\n" \
15460  " /* Lecture variable d'environnement : rapprochement ED */\n" \
15461  " memset(givtcRapED, 0, sizeof(givtcRapED));\n" \
15462  " /* constitution du nom du fichier Bloc */\n" \
15463  " (void)sprintf(conf, \"%s_%s\", \"GIV_RAP_EDITO\", GIXcNomDest);\n" \
15464  " iIntRet = GWTLireConf(conf, givtcRapED);\n" \
15465  "\n" \
15466  " if (GIV::GWTok != iIntRet)\n" \
15467  " {\n" \
15468  " (void)strcpy(givtcRapED, \"NON\");\n" \
15469  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de rapprochement Etab/ED dans la conf. Valeur par defaut <%s> prise \\n\", givtcRapED));\n" \
15470  " }\n" \
15471  "\n" \
15472  " /* Lecture variable d'environnement : contenu à traiter */\n" \
15473  " memset(givtcContenu, 0, sizeof(givtcContenu));\n" \
15474  " /* constitution du nom du fichier Bloc */\n" \
15475  " (void)sprintf(conf, \"%s_%s\", \"GIV_CONTENU\", GIXcNomDest);\n" \
15476  " iIntRet = GWTLireConf(conf, givtcContenu);\n" \
15477  "\n" \
15478  " if (GIV::GWTok != iIntRet)\n" \
15479  " {\n" \
15480  " (void)strcpy(givtcObjCont, \"\");\n" \
15481  " (void)strcpy(givtcContenu, \"NON\");\n" \
15482  " (void)strcpy(givtcRapED, \"NON\");\n" \
15483  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de contenu dans la conf \\n\"));\n" \
15484  " }\n" \
15485  " else\n" \
15486  " {\n" \
15487  " if (0 == strcmp(\"NON\", givtcContenu))\n" \
15488  " {\n" \
15489  " (void)strcpy(givtcObjCont, \"\");\n" \
15490  " (void)strcpy(givtcRapED, \"NON\");\n" \
15491  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de contenu dans la conf \\n\"));\n" \
15492  " }\n" \
15493  " }\n" \
15494  "\n" \
15495  " /* Lecture variable d'environnement : liste produits 'Annonces Mesurées' */\n" \
15496  " memset(givtcAnMes, 0, sizeof(givtcAnMes));\n" \
15497  " /* constitution du nom du paramètre */\n" \
15498  " (void)sprintf(conf, \"%s_%s\", \"GIV_AN_MES\", GIXcNomDest);\n" \
15499  " iIntRet = GWTLireConf(conf, givtcAnMes);\n" \
15500  "\n" \
15501  " if (GIV::GWTok != iIntRet)\n" \
15502  " {\n" \
15503  " (void)strcpy(givtcAnMes, \"\");\n" \
15504  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de produit 'Annonces Mesurées' dans la conf \\n\"));\n" \
15505  " }\n" \
15506  "\n" \
15507  " /* Lecture variable d'environnement : suppression qualite dans cpl denom */\n" \
15508  " memset(givtcSupCplDen, 0, sizeof(givtcSupCplDen));\n" \
15509  " /* constitution du nom du paramètre */\n" \
15510  " (void)sprintf(conf, \"%s_%s\", \"GIV_SUP_QUAL_CPL\", GIXcNomDest);\n" \
15511  " iIntRet = GWTLireConf(conf, givtcSupCplDen);\n" \
15512  "\n" \
15513  " if (GIV::GWTok != iIntRet)\n" \
15514  " (void)strcpy(givtcSupCplDen, \"NON\");\n" \
15515  "\n" \
15516  " GWTTrace(GWT_NIV_FONCT, (\"Suppression qual dans cpldenom <%s> \\n\", givtcSupCplDen));\n" \
15517  " /* Lecture variable d'environnement : inversion de la denomination exacte */\n" \
15518  " memset(givtcInvDenPn, 0, sizeof(givtcInvDenPn));\n" \
15519  " /* constitution du nom du paramètre */\n" \
15520  " (void)sprintf(conf, \"%s_%s\", \"INV_DNOM_PRE\", GIXcNomDest);\n" \
15521  " iIntRet = GWTLireConf(conf, givtcInvDenPn);\n" \
15522  "\n" \
15523  " if (GIV::GWTok != iIntRet)\n" \
15524  " (void)strcpy(givtcInvDenPn, \"NON\");\n" \
15525  "\n" \
15526  " GWTTrace(GWT_NIV_FONCT, (\"Inversion de la denomination exacte <%s> \\n\", givtcInvDenPn));\n" \
15527  " /* paramêtre d'accès à GYTtabIeBlocCRC */\n" \
15528  " (void)sprintf(conf, \"%s_%s\", \"GIV_GENE_IEBLOCEPJ_CRC\", GIXcNomDest);\n" \
15529  " iIntRet = GWTLireConf(conf, givtcGeneIeBlocCRC);\n" \
15530  "\n" \
15531  " if ((GIV::GWTok != iIntRet) || ((0 == strcmp(givRecreerCD, GIXcNomIntf)) && (0 == strcmp(GIXcValUrg, GWZUrgent))))\n" \
15532  " (void)strcpy(givtcGeneIeBlocCRC, \"NON\");\n" \
15533  "\n" \
15534  " GWTTrace(GWT_NIV_FONCT, (\"Accès GYTtabIeBlocCRC <%s> \\n\", givtcGeneIeBlocCRC));\n" \
15535  " /* paramêtre d'affichage AffCRC */\n" \
15536  " (void)sprintf(conf, \"%s_%s\", \"GIV_GENE_AFF_CRC\", GIXcNomDest);\n" \
15537  " iIntRet = GWTLireConf(conf, givtcGeneAffCRC);\n" \
15538  "\n" \
15539  " if (GIV::GWTok != iIntRet)\n" \
15540  " (void)strcpy(givtcGeneAffCRC, \"NON\");\n" \
15541  "\n" \
15542  " GWTTrace(GWT_NIV_FONCT, (\"AFFCRC <%s> \\n\", givtcGeneAffCRC));\n" \
15543  " /* Lecture variable d'environnement : contenu partenaire au niveau inscription */\n" \
15544  " (void)sprintf(conf, \"%s_%s\", \"GIV_CONTENU_PART_INSC\", GIXcNomDest);\n" \
15545  " iIntRet = GWTLireConf(conf, givtcPartInsc);\n" \
15546  "\n" \
15547  " if (GIV::GWTok != iIntRet)\n" \
15548  " (void)strcpy(givtcPartInsc, \"NON\");\n" \
15549  "\n" \
15550  " GWTTrace(GWT_NIV_FONCT, (\"contenu partenaire au niveau inscription <%s> \\n\", givtcPartInsc));\n" \
15551  " /* Lecture variable d'environnement : parution pour inscription par epj */\n" \
15552  " (void)sprintf(conf, \"%s_%s\", \"GIV_PARUTION_INSC_EPJ\", GIXcNomDest);\n" \
15553  " iIntRet = GWTLireConf(conf, givtcParuInscEpj);\n" \
15554  "\n" \
15555  " if (GIV::GWTok != iIntRet)\n" \
15556  " (void)strcpy(givtcParuInscEpj, \"NON\");\n" \
15557  "\n" \
15558  " /* Lecture variable d'environnement : format balise text */\n" \
15559  " (void)sprintf(conf, \"%s_%s\", \"GIV_CONTENU_TEXT_EPJ\", GIXcNomDest);\n" \
15560  " iIntRet = GWTLireConf(conf, givtcContText);\n" \
15561  "\n" \
15562  " if (GIV::GWTok != iIntRet)\n" \
15563  " (void)strcpy(givtcContText, \"NON\");\n" \
15564  "\n" \
15565  " /* pas de fichier ouvert */\n" \
15566  " GIVfDescFicMCD = NULL;\n" \
15567  " /* pas de bloc de référence */\n" \
15568  " memset(nom_bloc_ref, '0', sizeof(nom_bloc));\n" \
15569  " giviNumFic = giviNumFicInit;\n" \
15570  " /* préparation suppressions dans IeBloc */\n" \
15571  " iIntRet = givPreparerRequetesIeBloc();\n" \
15572  " return;\n" \
15573  "}\n" \
15574  "\n" \
15575  "/*----Fonction----------------------------------------------------------------*/\n" \
15576  "/* */\n" \
15577  "/* Fonction : giv_ecrit_partie_1 () */\n" \
15578  "/* */\n" \
15579  "/* But : ecrit la partie une du bloc de parution simple ou groupe */\n" \
15580  "/* */\n" \
15581  "/* */\n" \
15582  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
15583  "/* */\n" \
15584  "/* Sortie(s) : OK ou KO */\n" \
15585  "/* */\n" \
15586  "/* Portable : Transparent */\n" \
15587  "/* */\n" \
15588  "/* Modification (Jui/20/2006 - mb) : création de plusieurs fichiers de sortie */\n" \
15589  "/*----------------------------------------------------------------------------*/\n" \
15590  "\n" \
15591  "static int4 giv_ecrit_partie_1(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice)\n" \
15592  "\n" \
15593  "{\n" \
15594  " int4 lg_write;\n" \
15595  " char* buf_pos;\n" \
15596  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
15597  " char type_bloc[2]; /* Type de bloc : 'o' ou 'p' */\n" \
15598  " int4 lg_numlo;\n" \
15599  " int4 lg_IG, i;\n" \
15600  " int4 iIntRet = (int4)GIV::GWCCodeOK;\n" \
15601  " char chaine_id[7 + 1]; /* Numero qui s'incremente */\n" \
15602  " char ch[15 + 1]; /* Date du jour */\n" \
15603  " struct tm* pdh;\n" \
15604  " time_t intps;\n" \
15605  " int4 nbc;\n" \
15606  " char cNomFichier[128] = \"\"; /* Pathname des fichiers utilises */\n" \
15607  " char* pcVersion = NULL;\n" \
15608  " /* Calcul du numero d'identifiant parution_id */\n" \
15609  " num_id = num_id + 1;\n" \
15610  " sprintf(chaine_id, \"%07d\", num_id);\n" \
15611  "\n" \
15612  " if (obtention_iden == 0)\n" \
15613  " {\n" \
15614  " givInitConfGXX();\n" \
15615  " /* Pour ne plus recaluler au prochain passage */\n" \
15616  " obtention_iden = 1;\n" \
15617  " }\n" \
15618  "\n" \
15619  " /* init nom de bloc */\n" \
15620  " if (0 == strlen(doc->value.inscription[0].val_grp))\n" \
15621  " {\n" \
15622  " strcpy(nom_bloc, doc->value.a_classer.etab);\n" \
15623  " strcpy(nom_bloc_ref, nom_bloc);\n" \
15624  " GWTTrace(GWT_NIV_FONCT, (\"nom_bloc = %s\\n\", nom_bloc));\n" \
15625  " }\n" \
15626  " else\n" \
15627  " {\n" \
15628  " strcpy(nom_bloc, doc->value.a_classer.etab);\n" \
15629  " strcpy(nom_bloc_ref, nom_bloc);\n" \
15630  "\n" \
15631  " if (0 != iMaxBlocEcritAvant)\n" \
15632  " {\n" \
15633  " sprintf(chaine_id, \"%04d\", iMaxBlocEcritAvant);\n" \
15634  " strcat(nom_bloc, chaine_id);\n" \
15635  " }\n" \
15636  "\n" \
15637  " GWTTrace(GWT_NIV_FONCT, (\"nom_bloc = %s\\n\", nom_bloc));\n" \
15638  " }\n" \
15639  "\n" \
15640  " /* init numéro de bloc */\n" \
15641  " num_bloc = 1;\n" \
15642  " sprintf(chaine_id, \"%04d\", num_bloc);\n" \
15643  "\n" \
15644  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
15645  " sprintf(chaine_id, \"%04d\", 2);\n" \
15646  " else\n" \
15647  " sprintf(chaine_id, \"%04d\", 1);\n" \
15648  "\n" \
15649  " /* Generation de la chaine pour \"pjparutionid\" */\n" \
15650  " strcpy(doc->parution_id, nom_bloc);\n" \
15651  " strcpy(doc->parution_id_ref, nom_bloc_ref);\n" \
15652  "\n" \
15653  " for (i = 1; i < indice; i++)\n" \
15654  " strcpy((doc + i)->parution_id, (doc)->parution_id);\n" \
15655  "\n" \
15656  " buf_pos = *buf_pos_in;\n" \
15657  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"OPERATION\");\n" \
15658  " buf_pos = buf_pos + lg_write;\n" \
15659  " lg_write = giv_ecrit_balise(buf_pos, \"addition\", \"TYPE_OPERATION\");\n" \
15660  " buf_pos = buf_pos + lg_write;\n" \
15661  " lg_write = giv_ecrit_balise(buf_pos, doc->parution_id, \"NAME\");\n" \
15662  " buf_pos = buf_pos + lg_write;\n" \
15663  " pcVersion = strchr(pcVersionInsFour[0], (char)'.');\n" \
15664  " pcVersion++;\n" \
15665  "\n" \
15666  " if (0 == strlen(doc->value.numero_client))\n" \
15667  " (void)sprintf(&cNomFichier[0], \"%s/%c%c/%c%c/%s_v%s.xml\", givcCheminBloc, doc->value.inscription[0].moyen_de_com.numero[0], doc->value.inscription[0].moyen_de_com.numero[1],\n" \
15668  " doc->value.inscription[0].moyen_de_com.numero[2], doc->value.inscription[0].moyen_de_com.numero[3], doc->parution_id, pcVersion);\n" \
15669  " else\n" \
15670  " (void)sprintf(&cNomFichier[0], \"%s/%c%c/%c%c/%s_v%s.xml\", givcCheminBloc, doc->value.numero_client[0], doc->value.numero_client[1], doc->value.numero_client[2], doc->value.numero_client[3],\n" \
15671  " doc->parution_id, pcVersion);\n" \
15672  "\n" \
15673  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"CONTENT\");\n" \
15674  " buf_pos = buf_pos + lg_write;\n" \
15675  " *buf_pos_in = buf_pos;\n" \
15676  " return (iCodRet);\n" \
15677  "}\n" \
15678  "\n" \
15679  "/*----Fonction----------------------------------------------------------------*/\n" \
15680  "/* */\n" \
15681  "/* Fonction : giv_ecrit_partie_2_1 () */\n" \
15682  "/* */\n" \
15683  "/* But : ecrit la partie deux du bloc de parution simple ou groupe */\n" \
15684  "/* */\n" \
15685  "/* */\n" \
15686  "/* Entree(s) : un buffer, Structure Document */\n" \
15687  "/* */\n" \
15688  "/* Sortie(s) : OK ou KO */\n" \
15689  "/* */\n" \
15690  "/* Portable : Transparent */\n" \
15691  "/* */\n" \
15692  "/*----------------------------------------------------------------------------*/\n" \
15693  "static int4 giv_ecrit_partie_2_1(char** buf_pos_in, GYBrDOCUMENTEpj* docEPJ, GYBrDOCUMENTEpj* doc, int4 indice)\n" \
15694  "{\n" \
15695  " int4 lg_write;\n" \
15696  " char* buf_pos, *buf_pos_ref, *buf_pos_cur;\n" \
15697  " int4 iRet, iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
15698  " int4 lg_tmp, iDebut, iLg;\n" \
15699  " char* pcVersion = NULL;\n" \
15700  " char transforme_stype[2 + 1];\n" \
15701  " char ref_pub[1 + 2 + 2 + 1];\n" \
15702  " char tcRefext[17 + 1];\n" \
15703  " char tcNbimag[100];\n" \
15704  " char tcImagCat[2];\n" \
15705  " char tcMenu[2];\n" \
15706  " int4 i, j, x, y, z, zz;\n" \
15707  " int4 iLgChaineApvr;\n" \
15708  " char* pcDeb;\n" \
15709  " char* pcFin;\n" \
15710  " int4 pipe;\n" \
15711  " int4 iQualite;\n" \
15712  " char tcPrecision[2 + 1];\n" \
15713  " char tcStat[100 + 1];\n" \
15714  " int4 iRang;\n" \
15715  " GYBrIeinscT rInscRef;\n" \
15716  " GYBrIamicT rIamic;\n" \
15717  " GYBrIapartT rIapart;\n" \
15718  " GYBstrIeinscNumcliT tcNumcli;\n" \
15719  " char tcProduit[GYBIamicLgTypobj + (2 * GYBIamicLgTpdsob) + 1];\n" \
15720  " char tcEvt[2], tcPrg[2];\n" \
15721  " char* pt_fin_lst;\n" \
15722  " char* pt_debut;\n" \
15723  " char* pt_fin;\n" \
15724  " int4 iPrenom, iCpl, iMots, iMarq, iQual, iInMq = 0;\n" \
15725  " char cInfo, cAvis;\n" \
15726  " char tcElmt[29 + 1]; /* partenaire*/\n" \
15727  " /* Initialisation pointeur */\n" \
15728  " buf_pos = *buf_pos_in;\n" \
15729  "\n" \
15730  " /* Calcul du numero d'identifiant parution_id */\n" \
15731  " for (i = 0; i < indice; i++)\n" \
15732  " {\n" \
15733  " strcpy((doc + i)->value.numero_bloc_parution, doc->parution_id);\n" \
15734  " strcpy((doc + i)->value.numero_bloc_parution_ref, doc->parution_id_ref);\n" \
15735  " }\n" \
15736  "\n" \
15737  " /* Ecriture dans le fichier de sortie */\n" \
15738  " iCodRet = (int4)giv_fichier_sortie(&buf_pos, &GIVfDescFicMCD);\n" \
15739  " GIVfDescFicBloc = GIVfDescFicMCD;\n" \
15740  " lg_tmp = 0;\n" \
15741  " strcpy(buf_pos, \"<blocepj>\");\n" \
15742  " lg_tmp = strlen(buf_pos);\n" \
15743  " *(buf_pos + lg_tmp) = SEPARE_LIGNE;\n" \
15744  " *(buf_pos + (lg_tmp + 1)) = LINE_FEED;\n" \
15745  " *(buf_pos + (lg_tmp + 2)) = '\\0';\n" \
15746  " buf_pos = (buf_pos + lg_tmp + 2);\n" \
15747  " lg_write = giv_ecrit_balise(buf_pos, doc->value.numero_bloc_parution, \"blocepjid\");\n" \
15748  " buf_pos = buf_pos + lg_write;\n" \
15749  " pcVersion = strchr(pcVersionInsFour[0], (char)'.');\n" \
15750  " pcVersion++;\n" \
15751  " lg_write = giv_ecrit_balise(buf_pos, pcVersion, \"version\");\n" \
15752  " buf_pos = buf_pos + lg_write;\n" \
15753  " lg_write = giv_ecrit_balise(buf_pos, cDate, \"datmodblocepj\");\n" \
15754  " buf_pos = buf_pos + lg_write;\n" \
15755  " lg_write = giv_ecrit_balise(buf_pos, givtcVersDoc, \"vdoc\");\n" \
15756  " buf_pos = buf_pos + lg_write;\n" \
15757  "\n" \
15758  " for (i = 0; i < (indice); i++)\n" \
15759  " {\n" \
15760  " if (giv_cLEUR == (doc + i)->cNature)\n" \
15761  " {\n" \
15762  " /* indication de bloc leurre */\n" \
15763  " lg_write = giv_ecrit_balise(buf_pos, \"1\", \"leurre\");\n" \
15764  " buf_pos = buf_pos + lg_write;\n" \
15765  " break;\n" \
15766  " }\n" \
15767  " }\n" \
15768  "\n" \
15769  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"epj\");\n" \
15770  " buf_pos = buf_pos + lg_write;\n" \
15771  " /* Ecriture dans le fichier de sortie */\n" \
15772  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
15773  " lg_write = giv_ecrit_balise_epj(&buf_pos, docEPJ->value.intitule.denomination, \"denom\");\n" \
15774  " lg_write = giv_ecrit_balise_epj(&buf_pos, docEPJ->value.intitule.complement_denomination, \"cpldenom\");\n" \
15775  " lg_write = giv_ecrit_balise(buf_pos, docEPJ->value.a_classer.etab, \"etab\");\n" \
15776  " buf_pos = buf_pos + lg_write;\n" \
15777  " lg_write = giv_ecrit_balise(buf_pos, docEPJ->value.inscription[0].adresse.instal, \"codloc\");\n" \
15778  " buf_pos = buf_pos + lg_write;\n" \
15779  " lg_write = giv_ecrit_balise(buf_pos, docEPJ->value.inscription[0].adresse.numero_voie, \"numvoie\");\n" \
15780  " buf_pos = buf_pos + lg_write;\n" \
15781  " lg_write = giv_ecrit_balise(buf_pos, docEPJ->value.inscription[0].adresse.lib_complt_num_voie, \"libcplnumvoie\");\n" \
15782  " buf_pos = buf_pos + lg_write;\n" \
15783  " lg_write = giv_ecrit_balise(buf_pos, docEPJ->value.inscription[0].adresse.code_voie, \"codvoie\");\n" \
15784  " buf_pos = buf_pos + lg_write;\n" \
15785  " /* Ecriture dans le fichier de sortie */\n" \
15786  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
15787  "\n" \
15788  " if (0 != strlen(docEPJ->value.inscription[0].adresse.lib_code_voie))\n" \
15789  " lg_write = giv_ecrit_balise_epj(&buf_pos, docEPJ->value.inscription[0].adresse.lib_code_voie, \"libvoie\");\n" \
15790  " else\n" \
15791  " lg_write = giv_ecrit_balise_epj(&buf_pos, docEPJ->value.inscription[0].adresse.libel_voie, \"libvoie\");\n" \
15792  "\n" \
15793  " lg_write = giv_ecrit_balise_epj(&buf_pos, docEPJ->value.inscription[0].adresse.adrnr, \"adrnr\");\n" \
15794  " lg_write = giv_ecrit_balise(buf_pos, docEPJ->value.inscription[0].adresse.libinstal, \"libloc\");\n" \
15795  " buf_pos = buf_pos + lg_write;\n" \
15796  " lg_write = giv_ecrit_balise(buf_pos, docEPJ->value.inscription[0].adresse.geoloc.longitude, \"long\");\n" \
15797  " buf_pos = buf_pos + lg_write;\n" \
15798  " lg_write = giv_ecrit_balise(buf_pos, docEPJ->value.inscription[0].adresse.geoloc.latitude, \"lat\");\n" \
15799  " buf_pos = buf_pos + lg_write;\n" \
15800  " iQualite = atoi(docEPJ->value.inscription[0].adresse.geoloc.precision);\n" \
15801  "\n" \
15802  " switch (iQualite)\n" \
15803  " {\n" \
15804  " case 97:\n" \
15805  " case 99:\n" \
15806  " break;\n" \
15807  "\n" \
15808  " case 96:\n" \
15809  " case 98:\n" \
15810  " lg_write = giv_ecrit_balise(buf_pos, \"04\", \"precision\");\n" \
15811  " buf_pos = buf_pos + lg_write;\n" \
15812  " lg_write = giv_ecrit_balise(buf_pos, \"1\", \"srcprecision\");\n" \
15813  " buf_pos = buf_pos + lg_write;\n" \
15814  " break;\n" \
15815  "\n" \
15816  " default:\n" \
15817  " iQualite = iQualite % 4;\n" \
15818  " (void)sprintf(&tcPrecision[0], \"%02d\", iQualite);\n" \
15819  " lg_write = giv_ecrit_balise(buf_pos, tcPrecision, \"precision\");\n" \
15820  " buf_pos = buf_pos + lg_write;\n" \
15821  " iQualite = atoi(docEPJ->value.inscription[0].adresse.geoloc.precision);\n" \
15822  " iQualite = iQualite / 4;\n" \
15823  " (void)sprintf(&tcPrecision[0], \"%d\", iQualite);\n" \
15824  " lg_write = giv_ecrit_balise(buf_pos, tcPrecision, \"srcprecision\");\n" \
15825  " buf_pos = buf_pos + lg_write;\n" \
15826  " break;\n" \
15827  " }\n" \
15828  "\n" \
15829  " /* Ecriture dans le fichier de sortie */\n" \
15830  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
15831  " /* lecture et criture chapms Siret */\n" \
15832  " iDebut = 1;\n" \
15833  " iCodRet = givEcritureEtab(doc, &buf_pos, &iDebut);\n" \
15834  " iDebut = 1;\n" \
15835  " giviRefPJDC = -1;\n" \
15836  " /* lecture et écriture des denominations secondaires */\n" \
15837  " iCodRet = givEcritureDenomEtab(doc, &buf_pos, &iDebut);\n" \
15838  " /* Ecriture dans le fichier de sortie */\n" \
15839  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
15840  " /* analyse de partenaire PJDC */\n" \
15841  " iDebut = 1;\n" \
15842  "\n" \
15843  " for (j = 0; j < doc->value.a_classer.iNbPart; j++)\n" \
15844  " {\n" \
15845  " iLg = strlen(doc->value.a_classer.trpart[j].rpart) - 4;\n" \
15846  " doc->value.a_classer.trpart[j].iRgParent = giviNbParentPart;\n" \
15847  " doc->value.a_classer.trpart[j].iNbParent = 0;\n" \
15848  "\n" \
15849  " if (0 == strcmp(giv_PJDC, &doc->value.a_classer.trpart[j].rpart[iLg]))\n" \
15850  " {\n" \
15851  " giviRefPJDC = j;\n" \
15852  " /* lecture et écriture des denominations du partenaire PJDC parent */\n" \
15853  " iLg = strlen(doc->value.a_classer.trpart[j].rpart) - 4;\n" \
15854  " (void)strcpy(rIapart.acOriPart, &doc->value.a_classer.trpart[j].rpart[iLg]);\n" \
15855  " memcpy(rIapart.acRefPart, doc->value.a_classer.trpart[j].rpart, iLg);\n" \
15856  " rIapart.acRefPart[iLg] = '\\0';\n" \
15857  " strcpy(rIapart.acParentRefPart, doc->value.a_classer.trpart[j].parent);\n" \
15858  " strcpy(rIapart.acTypeRefPart, doc->value.a_classer.trpart[j].typepart);\n" \
15859  " /* intitule du partenaire pjdc */\n" \
15860  " lg_write = giv_init_denom_parent(buf_pos, doc->value.a_classer.etab, &iDebut);\n" \
15861  " buf_pos = buf_pos + lg_write;\n" \
15862  " /* Ecriture dans le fichier de sortie */\n" \
15863  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
15864  " GWTTrace(GWT_NIV_FONCT, (\"Type à traiter <%s> \\n\", doc->value.a_classer.trpart[j].typepart));\n" \
15865  "\n" \
15866  " if ((giv_orPJDC == rIapart.acTypeRefPart[0]) || (giv_cPJDC == rIapart.acTypeRefPart[0]))\n" \
15867  " {\n" \
15868  " /* recherche des types giv_svPJDC ou giv_prPJDC */\n" \
15869  " iRet = GIVLecturePartEtabNav(&buf_pos, &rIapart, givtrPart, &giviNbParentPart, &iDebut, NULL);\n" \
15870  " }\n" \
15871  " else if ((giv_prPJDC == rIapart.acTypeRefPart[0]) && (0 != strlen(rIapart.acParentRefPart)))\n" \
15872  " {\n" \
15873  " /* recherche des types giv_cPJDC ou giv_svPJDC ou/et giv_orPJDC */\n" \
15874  " iRet = GIVLecturePartEtabNav(&buf_pos, &rIapart, givtrPart, &giviNbParentPart, &iDebut, NULL);\n" \
15875  "\n" \
15876  " if ((0 != giviNbParentPart) && (giv_svPJDC == givtrPart[giviNbParentPart - 1].acTypeRefPart[0]))\n" \
15877  " {\n" \
15878  " if (0 != strlen(givtrPart[giviNbParentPart - 1].acParentRefPart))\n" \
15879  " {\n" \
15880  " if (0 != strcmp(rIapart.acRefPart, givtrPart[giviNbParentPart - 1].acParentRefPart))\n" \
15881  " {\n" \
15882  " rIapart.acTypeRefPart[0] = givtrPart[giviNbParentPart - 1].acTypeRefPart[0];\n" \
15883  " strcpy(rIapart.acParentRefPart, givtrPart[giviNbParentPart - 1].acParentRefPart);\n" \
15884  " iRet = GIVLecturePartEtabNav(&buf_pos, &rIapart, givtrPart, &giviNbParentPart, &iDebut, NULL);\n" \
15885  " }\n" \
15886  " }\n" \
15887  " }\n" \
15888  " }\n" \
15889  " else if (giv_svPJDC == rIapart.acTypeRefPart[0])\n" \
15890  " {\n" \
15891  " /* recherche des types giv_orPJDC et giv_prPJDC */\n" \
15892  " iRet = GIVLecturePartEtabNav(&buf_pos, &rIapart, givtrPart, &giviNbParentPart, &iDebut, NULL);\n" \
15893  "\n" \
15894  " if (0 != strlen(rIapart.acParentRefPart))\n" \
15895  " {\n" \
15896  " rIapart.acParentRefPart[0] = '\\0';\n" \
15897  " iRet = GIVLecturePartEtabNav(&buf_pos, &rIapart, givtrPart, &giviNbParentPart, &iDebut, NULL);\n" \
15898  " }\n" \
15899  " }\n" \
15900  "\n" \
15901  " doc->value.a_classer.trpart[j].iNbParent = giviNbParentPart - doc->value.a_classer.trpart[j].iRgParent;\n" \
15902  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"intitulelibpjdc\");\n" \
15903  " buf_pos = buf_pos + lg_write;\n" \
15904  " }\n" \
15905  " }\n" \
15906  "\n" \
15907  " if ('1' == doc->value.a_classer.parinsee)\n" \
15908  " {\n" \
15909  " lg_write = giv_ecrit_balise(buf_pos, docEPJ->value.a_classer.siret, \"siret\");\n" \
15910  " buf_pos = buf_pos + lg_write;\n" \
15911  " lg_write = giv_ecrit_balise(buf_pos, docEPJ->value.a_classer.naf, \"ape\");\n" \
15912  " buf_pos = buf_pos + lg_write;\n" \
15913  " }\n" \
15914  "\n" \
15915  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"epj\");\n" \
15916  " buf_pos = buf_pos + lg_write;\n" \
15917  " iRet = givLectureOldEtab(&buf_pos, doc->value.a_classer.etab);\n" \
15918  " /* Ecriture dans le fichier de sortie en UTF8 */\n" \
15919  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
15920  " /* intitulé principal */\n" \
15921  " iRang = givDnomPrincEtab(doc, indice);\n" \
15922  " doc->value.intitule.iRgPrinc = iRang;\n" \
15923  "\n" \
15924  " if (-1 != iRang)\n" \
15925  " {\n" \
15926  " strcpy(buf_concat, \"\");\n" \
15927  "\n" \
15928  " for (x = 0; x < indice; x++)\n" \
15929  " {\n" \
15930  " for (y = 0; y < (doc + x)->value.a_classer.iNbPart; y++)\n" \
15931  " {\n" \
15932  " if ((giv_prPJDC == (doc + x)->value.a_classer.trpart[y].typepart[0]) && (0 == strcmp(\"true\", (doc + x)->value.a_classer.trpart[y].isdoc)))\n" \
15933  " {\n" \
15934  " /* ajout possible de \"DR\" pour docteur */\n" \
15935  " break;\n" \
15936  " }\n" \
15937  " }\n" \
15938  "\n" \
15939  " if ((doc + x)->value.a_classer.iNbPart != y)\n" \
15940  " {\n" \
15941  " /* ajout possible de \"DR\" pour docteur */\n" \
15942  " break;\n" \
15943  " }\n" \
15944  " }\n" \
15945  "\n" \
15946  " if ((indice != x) && (0 == strlen((doc + iRang)->value.intitule.prenom)))\n" \
15947  " {\n" \
15948  " /* analyse de l'intitulé sans prénom pour PJDC */\n" \
15949  " strcpy(rInscRef.acNumnat, (doc + iRang)->value.inscription[0].val_num);\n" \
15950  " strcpy(rInscRef.acNumlo, (doc + iRang)->value.inscription[0].val_lo);\n" \
15951  " strcpy(rInscRef.acNumls, (doc + iRang)->value.inscription[0].val_ls);\n" \
15952  " iRet = GDQLibererCtxt();\n" \
15953  " iRet = GDQQualifBlocIntl(&rInscRef);\n" \
15954  "\n" \
15955  " if (GIV::GIXCodeRIEN == iRet)\n" \
15956  " {\n" \
15957  " /* ajout de \"DR\" pour docteur */\n" \
15958  " strcat(buf_concat, givTitreDoc);\n" \
15959  " }\n" \
15960  " }\n" \
15961  " else if ((indice != x) && (0 != strlen((doc + iRang)->value.intitule.prenom)))\n" \
15962  " {\n" \
15963  " /* ajout de \"DR\" pour docteur avec prénom */\n" \
15964  " strcat(buf_concat, givTitreDoc);\n" \
15965  " }\n" \
15966  "\n" \
15967  " for (i = 0; i < indice; i++)\n" \
15968  " {\n" \
15969  " for (j = 0; (j < (doc + i)->value.rubriques.iNban9 && ('0' == (doc + i)->value.rubriques.Tan9[j].dnex)); j++)\n" \
15970  " ;\n" \
15971  "\n" \
15972  " if ((doc + i)->value.rubriques.iNban9 != j)\n" \
15973  " break;\n" \
15974  " }\n" \
15975  "\n" \
15976  " if ((0 == strcmp(givtcInvDenPn, \"NON\")) || (indice == i))\n" \
15977  " {\n" \
15978  " strcat(buf_concat, (doc + iRang)->value.intitule.denomination);\n" \
15979  "\n" \
15980  " if (0 != strlen((doc + iRang)->value.intitule.prenom))\n" \
15981  " {\n" \
15982  " strcat(buf_concat, \" \");\n" \
15983  " strcat(buf_concat, (doc + iRang)->value.intitule.prenom);\n" \
15984  " }\n" \
15985  " }\n" \
15986  " else\n" \
15987  " {\n" \
15988  " /* inversion de l'ordre le la denomination exacte */\n" \
15989  " if (0 != strlen((doc + iRang)->value.intitule.prenom))\n" \
15990  " {\n" \
15991  " strcat(buf_concat, (doc + iRang)->value.intitule.prenom);\n" \
15992  " strcat(buf_concat, \" \");\n" \
15993  " strcat(buf_concat, (doc + iRang)->value.intitule.denomination);\n" \
15994  " }\n" \
15995  " else\n" \
15996  " strcat(buf_concat, (doc + iRang)->value.intitule.denomination);\n" \
15997  " }\n" \
15998  "\n" \
15999  " if (0 != strlen((doc + iRang)->value.intitule.complement_denomination))\n" \
16000  " {\n" \
16001  " strcat(buf_concat, \" \");\n" \
16002  " strcat(buf_concat, (doc + iRang)->value.intitule.complement_denomination);\n" \
16003  " }\n" \
16004  "\n" \
16005  " lg_write = giv_ecrit_balise_iso(buf_pos, buf_concat, \"intlprincipal\");\n" \
16006  " buf_pos = buf_pos + lg_write;\n" \
16007  " }\n" \
16008  "\n" \
16009  " /* Ecriture dans le fichier de sortie */\n" \
16010  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
16011  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"seo\");\n" \
16012  " buf_pos = buf_pos + lg_write;\n" \
16013  "\n" \
16014  " if ((0 != strlen(doc->value.a_classer.etab)) && ('0' != doc->cPubPrinc) && (giv_cLEUR != doc->cNature))\n" \
16015  " {\n" \
16016  " GWTTrace(GWT_NIV_FONCT, (\"Etab SEO... %s\\n\", doc->value.a_classer.etab));\n" \
16017  " lg_write = giv_ecrit_balise(buf_pos, doc->value.a_classer.etab, \"lepj\");\n" \
16018  " buf_pos = buf_pos + lg_write;\n" \
16019  " lg_write = giv_ecrit_balise(buf_pos, doc->value.a_classer.etab, \"epj\");\n" \
16020  " buf_pos = buf_pos + lg_write;\n" \
16021  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"longseo\");\n" \
16022  " buf_pos = buf_pos + lg_write;\n" \
16023  "\n" \
16024  " if (0 != strlen(doc->value.a_classer.etab))\n" \
16025  " {\n" \
16026  " iRet = givServiceEtabSEO(doc, &cInfo, &cAvis);\n" \
16027  "\n" \
16028  " if ((int4)GIV::GIXCodeOK == iRet && 'o' == cInfo)\n" \
16029  " {\n" \
16030  " GWTTrace(GWT_NIV_FONCT, (\"Info Etab SEO...\\n\"));\n" \
16031  " lg_write = giv_ecrit_balise(buf_pos, \"info\", \"ongseo\");\n" \
16032  " buf_pos = buf_pos + lg_write;\n" \
16033  " }\n" \
16034  "\n" \
16035  " if ((int4)GIV::GIXCodeOK == iRet && 'o' == cAvis)\n" \
16036  " {\n" \
16037  " GWTTrace(GWT_NIV_FONCT, (\"Avis Etab SEO...\\n\"));\n" \
16038  " lg_write = giv_ecrit_balise(buf_pos, \"avis\", \"ongseo\");\n" \
16039  " buf_pos = buf_pos + lg_write;\n" \
16040  " }\n" \
16041  " }\n" \
16042  "\n" \
16043  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"longseo\");\n" \
16044  " buf_pos = buf_pos + lg_write;\n" \
16045  " }\n" \
16046  "\n" \
16047  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"seo\");\n" \
16048  " buf_pos = buf_pos + lg_write;\n" \
16049  "\n" \
16050  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
16051  " lg_write = giv_ecrit_balise(buf_pos, \"2\", \"typeclient\");\n" \
16052  " else\n" \
16053  " lg_write = giv_ecrit_balise(buf_pos, \"1\", \"typeclient\");\n" \
16054  "\n" \
16055  " buf_pos = buf_pos + lg_write;\n" \
16056  "\n" \
16057  " if (0 != strlen(doc->value.a_classer.etab))\n" \
16058  " {\n" \
16059  " /* établissement */\n" \
16060  " lg_write = giv_ecrit_balise(buf_pos, \"1\", \"petab\");\n" \
16061  " }\n" \
16062  " else\n" \
16063  " lg_write = giv_ecrit_balise(buf_pos, \"0\", \"petab\");\n" \
16064  "\n" \
16065  " buf_pos = buf_pos + lg_write;\n" \
16066  "\n" \
16067  " if (0 != strlen(doc->value.a_classer.etab))\n" \
16068  " {\n" \
16069  " iRet = givLectureEvIlo(doc->value.a_classer.etab, &tcEvt[0], &tcPrg[0]);\n" \
16070  " tcEvt[1] = '\\0';\n" \
16071  " tcPrg[1] = '\\0';\n" \
16072  " lg_write = giv_ecrit_balise(buf_pos, tcPrg, \"iloprg\");\n" \
16073  " buf_pos = buf_pos + lg_write;\n" \
16074  " lg_write = giv_ecrit_balise(buf_pos, tcEvt, \"iloevt\");\n" \
16075  " buf_pos = buf_pos + lg_write;\n" \
16076  " iRet = givLectureEtabMC(doc->value.a_classer.etab, doc->value.a_classer.parinsee, &buf_pos);\n" \
16077  " }\n" \
16078  "\n" \
16079  " if ((0 != strlen(doc->value.a_classer.siret)) && ('1' == doc->value.a_classer.parinsee))\n" \
16080  " {\n" \
16081  " iRet = givLectureSIRET(doc->value.a_classer.siret);\n" \
16082  "\n" \
16083  " if ((int4)GIV::GIXCodeOK == iRet)\n" \
16084  " {\n" \
16085  " lg_write = giv_ecrit_balise(buf_pos, \"1\", \"pagespro\");\n" \
16086  " buf_pos = buf_pos + lg_write;\n" \
16087  " }\n" \
16088  " }\n" \
16089  "\n" \
16090  " if (0 != strlen(doc->value.a_classer.etab))\n" \
16091  " {\n" \
16092  " /* BonPlan autorisé pour les IO et les IS */\n" \
16093  " iRet = givEcritureBonPlan(doc->value.a_classer.etab, &buf_pos);\n" \
16094  " }\n" \
16095  "\n" \
16096  " pipe = 0;\n" \
16097  "\n" \
16098  " for (x = 0; x < indice; x++)\n" \
16099  " {\n" \
16100  " if (pipe == 0)\n" \
16101  " {\n" \
16102  " strcpy(buf_concat, (doc + x)->value.numero_client);\n" \
16103  " pipe = 1;\n" \
16104  " }\n" \
16105  " else\n" \
16106  " {\n" \
16107  " strcat(buf_concat, \"|\");\n" \
16108  " strcat(buf_concat, (doc + x)->value.numero_client);\n" \
16109  " }\n" \
16110  " }\n" \
16111  "\n" \
16112  " if (1 == pipe)\n" \
16113  " {\n" \
16114  " iRet = supprimer_doublon(buf_concat, '|');\n" \
16115  " pt_fin_lst = buf_concat + strlen(buf_concat);\n" \
16116  "\n" \
16117  " for (pt_debut = buf_concat; pt_debut < pt_fin_lst;)\n" \
16118  " {\n" \
16119  " pt_fin = strchr(pt_debut, '|');\n" \
16120  "\n" \
16121  " if (pt_fin == 0)\n" \
16122  " pt_fin = pt_fin_lst;\n" \
16123  "\n" \
16124  " /* analyse client */\n" \
16125  " memcpy(tcNumcli, pt_debut, (pt_fin - pt_debut));\n" \
16126  " tcNumcli[(pt_fin - pt_debut)] = '\\0';\n" \
16127  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"numclis\");\n" \
16128  " buf_pos = buf_pos + lg_write;\n" \
16129  " lg_write = giv_ecrit_element(buf_pos, \"numcli\", tcNumcli);\n" \
16130  " buf_pos = buf_pos + lg_write;\n" \
16131  " iRet = givLectureStat(tcNumcli, tcStat);\n" \
16132  " lg_write = giv_ecrit_balise(buf_pos, tcStat, \"estatan\");\n" \
16133  " buf_pos = buf_pos + lg_write;\n" \
16134  " iRet = givLectureEmbauche(tcNumcli, tcRefext);\n" \
16135  " lg_write = giv_ecrit_balise(buf_pos, tcRefext, \"jobid\");\n" \
16136  " buf_pos = buf_pos + lg_write;\n" \
16137  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"numclis\");\n" \
16138  " buf_pos = buf_pos + lg_write;\n" \
16139  " pt_debut = pt_fin + 1;\n" \
16140  " }\n" \
16141  " }\n" \
16142  "\n" \
16143  " buf_concat[0] = '\\0';\n" \
16144  "\n" \
16145  " for (x = 0; x < indice; x++)\n" \
16146  " {\n" \
16147  " if ((0 != strlen((doc + x)->value.a_classer.etab)) && (0 == strcmp(\"0000\", (doc + x)->value.inscription[0].val_ls)) && ('0' == (doc + x)->cIndPart))\n" \
16148  " {\n" \
16149  " iRet = givLectureBUC((doc + x)->value.a_classer.etab, \"0001\", \"7999\");\n" \
16150  " break;\n" \
16151  " }\n" \
16152  " }\n" \
16153  "\n" \
16154  " if (0 != strlen(buf_concat))\n" \
16155  " {\n" \
16156  " GWTTrace(GWT_NIV_FONCT, (\" BUC... %s\\n\", buf_concat));\n" \
16157  " iRet = supprimer_doublon(buf_concat, '|');\n" \
16158  " pt_fin_lst = buf_concat + strlen(buf_concat);\n" \
16159  "\n" \
16160  " for (pt_debut = buf_concat; pt_debut < pt_fin_lst;)\n" \
16161  " {\n" \
16162  " pt_fin = strchr(pt_debut, '|');\n" \
16163  "\n" \
16164  " if (pt_fin == 0)\n" \
16165  " pt_fin = pt_fin_lst;\n" \
16166  "\n" \
16167  " /* analyse client */\n" \
16168  " memcpy(tcNumcli, pt_debut, (pt_fin - pt_debut));\n" \
16169  " tcNumcli[(pt_fin - pt_debut)] = '\\0';\n" \
16170  " lg_write = giv_ecrit_element(buf_pos, \"numclipj\", tcNumcli);\n" \
16171  " buf_pos = buf_pos + lg_write;\n" \
16172  " pt_debut = pt_fin + 1;\n" \
16173  " }\n" \
16174  " }\n" \
16175  "\n" \
16176  " buf_concat[0] = '\\0';\n" \
16177  "\n" \
16178  " for (x = 0; x < indice; x++)\n" \
16179  " {\n" \
16180  " if ((0 != strlen((doc + x)->value.a_classer.etab)) && (0 == strcmp(\"0000\", (doc + x)->value.inscription[0].val_ls)) && ('0' == (doc + x)->cIndPart))\n" \
16181  " {\n" \
16182  " iRet = givLectureBUC((doc + x)->value.a_classer.etab, \"8000\", \"9999\");\n" \
16183  " break;\n" \
16184  " }\n" \
16185  " }\n" \
16186  "\n" \
16187  " if (0 != strlen(buf_concat))\n" \
16188  " {\n" \
16189  " GWTTrace(GWT_NIV_FONCT, (\" BUC... %s\\n\", buf_concat));\n" \
16190  " iRet = supprimer_doublon(buf_concat, '|');\n" \
16191  " pt_fin_lst = buf_concat + strlen(buf_concat);\n" \
16192  "\n" \
16193  " for (pt_debut = buf_concat; pt_debut < pt_fin_lst;)\n" \
16194  " {\n" \
16195  " pt_fin = strchr(pt_debut, '|');\n" \
16196  "\n" \
16197  " if (pt_fin == 0)\n" \
16198  " pt_fin = pt_fin_lst;\n" \
16199  "\n" \
16200  " /* analyse client */\n" \
16201  " memcpy(tcNumcli, pt_debut, (pt_fin - pt_debut));\n" \
16202  " tcNumcli[(pt_fin - pt_debut)] = '\\0';\n" \
16203  " lg_write = giv_ecrit_element(buf_pos, \"numclicdh\", tcNumcli);\n" \
16204  " buf_pos = buf_pos + lg_write;\n" \
16205  " pt_debut = pt_fin + 1;\n" \
16206  " }\n" \
16207  " }\n" \
16208  "\n" \
16209  " memset(buf_concat, 0, strlen(buf_concat));\n" \
16210  " lg_write = giv_ecrit_balise(buf_pos, doc->value.intitule.datefinparu, \"finparut\");\n" \
16211  " buf_pos = buf_pos + lg_write;\n" \
16212  " /* Ecriture dans le fichier de sortie en UTF8 */\n" \
16213  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
16214  "\n" \
16215  " for (x = 0; x < indice; x++)\n" \
16216  " {\n" \
16217  " if (0 == x)\n" \
16218  " y = x;\n" \
16219  " else\n" \
16220  " y = x - 1;\n" \
16221  "\n" \
16222  " if ((0 == x) || (0 != strcmp((doc + x)->value.intitule.denomination, (doc + y)->value.intitule.denomination)))\n" \
16223  " {\n" \
16224  " if (0 != x)\n" \
16225  " {\n" \
16226  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"intitulemarques\");\n" \
16227  " buf_pos = buf_pos + lg_write;\n" \
16228  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"qualites\");\n" \
16229  " buf_pos = buf_pos + lg_write;\n" \
16230  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"marquess\");\n" \
16231  " buf_pos = buf_pos + lg_write;\n" \
16232  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"motsdets\");\n" \
16233  " buf_pos = buf_pos + lg_write;\n" \
16234  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"cpldenoms\");\n" \
16235  " buf_pos = buf_pos + lg_write;\n" \
16236  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"prenoms\");\n" \
16237  " buf_pos = buf_pos + lg_write;\n" \
16238  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"intitule\");\n" \
16239  " buf_pos = buf_pos + lg_write;\n" \
16240  " }\n" \
16241  "\n" \
16242  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"intitule\");\n" \
16243  " buf_pos = buf_pos + lg_write;\n" \
16244  " lg_write = giv_ecrit_balise_iso(buf_pos, (doc + x)->value.intitule.denomination, \"denom\");\n" \
16245  " buf_pos = buf_pos + lg_write;\n" \
16246  " iRet = givLectureSynonyme(doc, &buf_pos, x, indice);\n" \
16247  " iPrenom = 1;\n" \
16248  " }\n" \
16249  "\n" \
16250  " if ((1 == iPrenom) || (0 != strcmp((doc + x)->value.intitule.prenom, (doc + y)->value.intitule.prenom)))\n" \
16251  " {\n" \
16252  " if (1 != iPrenom)\n" \
16253  " {\n" \
16254  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"intitulemarques\");\n" \
16255  " buf_pos = buf_pos + lg_write;\n" \
16256  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"qualites\");\n" \
16257  " buf_pos = buf_pos + lg_write;\n" \
16258  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"marquess\");\n" \
16259  " buf_pos = buf_pos + lg_write;\n" \
16260  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"motsdets\");\n" \
16261  " buf_pos = buf_pos + lg_write;\n" \
16262  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"cpldenoms\");\n" \
16263  " buf_pos = buf_pos + lg_write;\n" \
16264  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"prenoms\");\n" \
16265  " buf_pos = buf_pos + lg_write;\n" \
16266  " }\n" \
16267  "\n" \
16268  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"prenoms\");\n" \
16269  " buf_pos = buf_pos + lg_write;\n" \
16270  " lg_write = giv_ecrit_balise_iso(buf_pos, (doc + x)->value.intitule.prenom, \"prenom\");\n" \
16271  " buf_pos = buf_pos + lg_write;\n" \
16272  " lg_write = giv_ecrit_balise_iso(buf_pos, (doc + x)->value.intitule.initiale, \"iprenom\");\n" \
16273  " buf_pos = buf_pos + lg_write;\n" \
16274  "\n" \
16275  " for (z = 0; z < indice; z++)\n" \
16276  " {\n" \
16277  " for (zz = 0; (zz < (doc + z)->value.rubriques.iNban9 && ('0' == (doc + z)->value.rubriques.Tan9[zz].dnex)); zz++)\n" \
16278  " ;\n" \
16279  "\n" \
16280  " if ((doc + z)->value.rubriques.iNban9 != zz)\n" \
16281  " break;\n" \
16282  " }\n" \
16283  "\n" \
16284  " if ((0 == strcmp(givtcInvDenPn, \"NON\")) || (indice == z))\n" \
16285  " {\n" \
16286  " strcpy(buf_concat, (doc + x)->value.intitule.denomination);\n" \
16287  "\n" \
16288  " if (0 != strlen((doc + x)->value.intitule.prenom))\n" \
16289  " {\n" \
16290  " strcat(buf_concat, \" \");\n" \
16291  " strcat(buf_concat, (doc + x)->value.intitule.prenom);\n" \
16292  " }\n" \
16293  " }\n" \
16294  " else\n" \
16295  " {\n" \
16296  " /* inversion de l'ordre le la denomination exacte */\n" \
16297  " if (0 != strlen((doc + x)->value.intitule.prenom))\n" \
16298  " {\n" \
16299  " strcpy(buf_concat, (doc + x)->value.intitule.prenom);\n" \
16300  " strcat(buf_concat, \" \");\n" \
16301  " strcat(buf_concat, (doc + x)->value.intitule.denomination);\n" \
16302  " }\n" \
16303  " else\n" \
16304  " strcpy(buf_concat, (doc + x)->value.intitule.denomination);\n" \
16305  " }\n" \
16306  "\n" \
16307  " lg_write = giv_ecrit_balise_iso(buf_pos, buf_concat, \"denomexacte\");\n" \
16308  " buf_pos = buf_pos + lg_write;\n" \
16309  " iPrenom = 0;\n" \
16310  " iCpl = 1;\n" \
16311  " }\n" \
16312  "\n" \
16313  " if ((1 == iCpl) || (0 != strcmp((doc + x)->value.inscription[0].moyen_de_com.laqualite, (doc + y)->value.inscription[0].moyen_de_com.laqualite)))\n" \
16314  " {\n" \
16315  " if (1 != iCpl)\n" \
16316  " {\n" \
16317  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"intitulemarques\");\n" \
16318  " buf_pos = buf_pos + lg_write;\n" \
16319  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"qualites\");\n" \
16320  " buf_pos = buf_pos + lg_write;\n" \
16321  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"marquess\");\n" \
16322  " buf_pos = buf_pos + lg_write;\n" \
16323  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"motsdets\");\n" \
16324  " buf_pos = buf_pos + lg_write;\n" \
16325  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"cpldenoms\");\n" \
16326  " buf_pos = buf_pos + lg_write;\n" \
16327  " }\n" \
16328  "\n" \
16329  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"cpldenoms\");\n" \
16330  " buf_pos = buf_pos + lg_write;\n" \
16331  " memset(buf_concat, 0, strlen(buf_concat));\n" \
16332  " strcpy(buf_concat, (doc + x)->value.intitule.complement_denomination);\n" \
16333  "\n" \
16334  " if (0 == strcmp(givtcSupCplDen, \"OUI\"))\n" \
16335  " {\n" \
16336  " if (0 == strcmp((doc + x)->value.intitule.complement_denomination, (doc + x)->value.inscription[0].moyen_de_com.laqualite))\n" \
16337  " buf_concat[0] = '\\0';\n" \
16338  " else if (0 != strlen((doc + x)->value.inscription[0].moyen_de_com.laqualite))\n" \
16339  " {\n" \
16340  " pcDeb = strstr(buf_concat, (doc + x)->value.inscription[0].moyen_de_com.laqualite);\n" \
16341  "\n" \
16342  " if (NULL != pcDeb)\n" \
16343  " {\n" \
16344  " if ((pcDeb == &buf_concat[0]) && (' ' == *(pcDeb + strlen((doc + x)->value.inscription[0].moyen_de_com.laqualite))))\n" \
16345  " (void)strcpy(pcDeb, pcDeb + strlen((doc + x)->value.inscription[0].moyen_de_com.laqualite) + 1);\n" \
16346  " else if ((pcDeb != &buf_concat[0]) && (' ' == *(pcDeb - 1)) && (' ' == *(pcDeb + strlen((doc + x)->value.inscription[0].moyen_de_com.laqualite))))\n" \
16347  " (void)strcpy(pcDeb, pcDeb + strlen((doc + x)->value.inscription[0].moyen_de_com.laqualite) + 1);\n" \
16348  " else if ((pcDeb != &buf_concat[0]) && (' ' == *(pcDeb - 1)) && ('\\0' == *(pcDeb + strlen((doc + x)->value.inscription[0].moyen_de_com.laqualite))))\n" \
16349  " *(pcDeb - 1) = '\\0';\n" \
16350  " }\n" \
16351  " }\n" \
16352  " }\n" \
16353  "\n" \
16354  " lg_write = giv_ecrit_balise_iso(buf_pos, buf_concat, \"cpldenom\");\n" \
16355  " buf_pos = buf_pos + lg_write;\n" \
16356  " iCpl = 0;\n" \
16357  " iMots = 1;\n" \
16358  " }\n" \
16359  "\n" \
16360  " if ((1 == iMots) || (0 != strcmp((doc + x)->value.intitule.mots_determinants, (doc + y)->value.intitule.mots_determinants)))\n" \
16361  " {\n" \
16362  " if (1 != iMots)\n" \
16363  " {\n" \
16364  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"intitulemarques\");\n" \
16365  " buf_pos = buf_pos + lg_write;\n" \
16366  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"qualites\");\n" \
16367  " buf_pos = buf_pos + lg_write;\n" \
16368  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"marquess\");\n" \
16369  " buf_pos = buf_pos + lg_write;\n" \
16370  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"motsdets\");\n" \
16371  " buf_pos = buf_pos + lg_write;\n" \
16372  " }\n" \
16373  "\n" \
16374  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"motsdets\");\n" \
16375  " buf_pos = buf_pos + lg_write;\n" \
16376  " lg_write = giv_ecrit_balise_iso(buf_pos, (doc + x)->value.intitule.mots_determinants, \"motsdet\");\n" \
16377  " buf_pos = buf_pos + lg_write;\n" \
16378  " iMots = 0;\n" \
16379  " iMarq = 1;\n" \
16380  " }\n" \
16381  "\n" \
16382  " if ((1 == iMarq) || (0 != strcmp((doc + x)->value.inscription[0].moyen_de_com.lamarque, (doc + y)->value.inscription[0].moyen_de_com.lamarque)))\n" \
16383  " {\n" \
16384  " if (1 != iMarq)\n" \
16385  " {\n" \
16386  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"intitulemarques\");\n" \
16387  " buf_pos = buf_pos + lg_write;\n" \
16388  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"qualites\");\n" \
16389  " buf_pos = buf_pos + lg_write;\n" \
16390  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"marquess\");\n" \
16391  " buf_pos = buf_pos + lg_write;\n" \
16392  " }\n" \
16393  "\n" \
16394  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"marquess\");\n" \
16395  " buf_pos = buf_pos + lg_write;\n" \
16396  " lg_write = giv_ecrit_balise_iso(buf_pos, (doc + x)->value.inscription[0].moyen_de_com.lamarque, \"marques\");\n" \
16397  " buf_pos = buf_pos + lg_write;\n" \
16398  " memset(buf_concat, 0, strlen(buf_concat));\n" \
16399  " strcpy(buf_concat, (doc + x)->value.intitule.denomination);\n" \
16400  "\n" \
16401  " if (0 == strcmp((doc + x)->value.intitule.denomination, (doc + x)->value.inscription[0].moyen_de_com.lamarque))\n" \
16402  " buf_concat[0] = '\\0';\n" \
16403  " else if (0 != strlen((doc + x)->value.inscription[0].moyen_de_com.lamarque))\n" \
16404  " {\n" \
16405  " pcDeb = strstr(buf_concat, (doc + x)->value.inscription[0].moyen_de_com.lamarque);\n" \
16406  "\n" \
16407  " if (NULL != pcDeb)\n" \
16408  " {\n" \
16409  " if ((pcDeb == &buf_concat[0]) && (' ' == *(pcDeb + strlen((doc + x)->value.inscription[0].moyen_de_com.lamarque))))\n" \
16410  " (void)strcpy(pcDeb, pcDeb + strlen((doc + x)->value.inscription[0].moyen_de_com.lamarque) + 1);\n" \
16411  " else if ((pcDeb != &buf_concat[0]) && (' ' == *(pcDeb - 1)) && (' ' == *(pcDeb + strlen((doc + x)->value.inscription[0].moyen_de_com.lamarque))))\n" \
16412  " (void)strcpy(pcDeb, pcDeb + strlen((doc + x)->value.inscription[0].moyen_de_com.lamarque) + 1);\n" \
16413  " else if ((pcDeb != &buf_concat[0]) && (' ' == *(pcDeb - 1)) && ('\\0' == *(pcDeb + strlen((doc + x)->value.inscription[0].moyen_de_com.lamarque))))\n" \
16414  " *(pcDeb - 1) = '\\0';\n" \
16415  " }\n" \
16416  " }\n" \
16417  "\n" \
16418  " lg_write = giv_ecrit_balise_iso(buf_pos, buf_concat, \"rs\");\n" \
16419  " buf_pos = buf_pos + lg_write;\n" \
16420  " iMarq = 0;\n" \
16421  " iQual = 1;\n" \
16422  " }\n" \
16423  "\n" \
16424  " if ((1 == iQual) || (0 != strcmp((doc + x)->value.inscription[0].moyen_de_com.laqualite, (doc + y)->value.inscription[0].moyen_de_com.laqualite)))\n" \
16425  " {\n" \
16426  " if (1 != iQual)\n" \
16427  " {\n" \
16428  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"intitulemarques\");\n" \
16429  " buf_pos = buf_pos + lg_write;\n" \
16430  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"qualites\");\n" \
16431  " buf_pos = buf_pos + lg_write;\n" \
16432  " }\n" \
16433  "\n" \
16434  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"qualites\");\n" \
16435  " buf_pos = buf_pos + lg_write;\n" \
16436  " lg_write = giv_ecrit_balise_iso(buf_pos, (doc + x)->value.inscription[0].moyen_de_com.laqualite, \"qualite\");\n" \
16437  " buf_pos = buf_pos + lg_write;\n" \
16438  " iQual = 0;\n" \
16439  " iInMq = 1;\n" \
16440  " }\n" \
16441  "\n" \
16442  " if ((1 == iInMq) || (0 != strcmp((doc + x)->value.intitule.tcIntlAnnot, (doc + y)->value.intitule.tcIntlAnnot)))\n" \
16443  " {\n" \
16444  " if (1 != iInMq)\n" \
16445  " {\n" \
16446  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"intitulemarques\");\n" \
16447  " buf_pos = buf_pos + lg_write;\n" \
16448  " }\n" \
16449  "\n" \
16450  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"intitulemarques\");\n" \
16451  " buf_pos = buf_pos + lg_write;\n" \
16452  "\n" \
16453  " if (0 != strlen((doc + x)->value.intitule.tcIntlAnnot))\n" \
16454  " {\n" \
16455  " /* Ecriture dans le fichier de sortie */\n" \
16456  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
16457  " /* conversion du XMLType */\n" \
16458  " (void)strcpy(GIVBuffInter, (doc + x)->value.intitule.tcIntlAnnot);\n" \
16459  " (void)givConvClob();\n" \
16460  " giviConflitCRC = GIV::GWCCodeKO;\n" \
16461  " iRet = givAnalyseObjetXML(\"I1\", doc + x, GIVBuffInter, &buf_pos);\n" \
16462  " /* Ecriture dans le fichier de sortie de l'annotation déjà en UTF8 */\n" \
16463  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
16464  " }\n" \
16465  "\n" \
16466  " iInMq = 0;\n" \
16467  " }\n" \
16468  " }\n" \
16469  "\n" \
16470  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"intitulemarques\");\n" \
16471  " buf_pos = buf_pos + lg_write;\n" \
16472  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"qualites\");\n" \
16473  " buf_pos = buf_pos + lg_write;\n" \
16474  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"marquess\");\n" \
16475  " buf_pos = buf_pos + lg_write;\n" \
16476  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"motsdets\");\n" \
16477  " buf_pos = buf_pos + lg_write;\n" \
16478  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"cpldenoms\");\n" \
16479  " buf_pos = buf_pos + lg_write;\n" \
16480  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"prenoms\");\n" \
16481  " buf_pos = buf_pos + lg_write;\n" \
16482  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"intitule\");\n" \
16483  " buf_pos = buf_pos + lg_write;\n" \
16484  " /* Ecriture dans le fichier de sortie */\n" \
16485  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
16486  " /* intitulés de LO présents dans les données additionnelles de source GC-EN */\n" \
16487  " GWTTrace(GWT_NIV_FONCT, (\" GC-EN ... %s,%s\\n\", (doc + x)->value.inscription[0].val_lslo, givtcObjCont));\n" \
16488  "\n" \
16489  " if (0 != strstr(givtcObjCont, giv_GCEN))\n" \
16490  " {\n" \
16491  " /* lecture en base de DA GC-EN */\n" \
16492  " iRet = givLectureEtabDonSupp(doc->value.a_classer.etab, \"\", giv_GCEN, giv_ADG);\n" \
16493  " GWTTrace(GWT_NIV_FONCT, (\" GC-EN ... %s\\n\", GIVBuffInter));\n" \
16494  " iLg = strlen(GIVBuffInter);\n" \
16495  "\n" \
16496  " if (0 != iLg)\n" \
16497  " {\n" \
16498  " pcDeb = GIVBuffInter;\n" \
16499  " strcat(buf_pos, \"<listeLibEnseigneEpj>\");\n" \
16500  " lg_write = strlen(buf_pos);\n" \
16501  " *(buf_pos + lg_write) = SEPARE_LIGNE;\n" \
16502  " *(buf_pos + lg_write + 1) = LINE_FEED;\n" \
16503  " *(buf_pos + lg_write + 2) = '\\0';\n" \
16504  "\n" \
16505  " while ((GIVBuffInter + iLg) > pcDeb && (NULL != pcDeb))\n" \
16506  " {\n" \
16507  " pcDeb = strstr(pcDeb, \"<libelleEnseigne>\");\n" \
16508  " pcDeb += strlen(\"<libelleEnseigne>\");\n" \
16509  " pcFin = strchr(pcDeb, '<');\n" \
16510  " *pcFin = '\\0';\n" \
16511  " pcFin++;\n" \
16512  " strcat(buf_pos, \"<libEnseigneEpj>\");\n" \
16513  " strcat(buf_pos, pcDeb);\n" \
16514  " strcat(buf_pos, \"</libEnseigneEpj>\");\n" \
16515  " lg_write = strlen(buf_pos);\n" \
16516  " *(buf_pos + lg_write) = SEPARE_LIGNE;\n" \
16517  " *(buf_pos + lg_write + 1) = LINE_FEED;\n" \
16518  " *(buf_pos + lg_write + 2) = '\\0';\n" \
16519  " pcDeb = strstr(pcFin, \"<libelleEnseigne>\");\n" \
16520  " }\n" \
16521  "\n" \
16522  " strcat(buf_pos, \"</listeLibEnseigneEpj>\");\n" \
16523  " lg_write = strlen(buf_pos);\n" \
16524  " *(buf_pos + lg_write) = SEPARE_LIGNE;\n" \
16525  " *(buf_pos + lg_write + 1) = LINE_FEED;\n" \
16526  " *(buf_pos + lg_write + 2) = '\\0';\n" \
16527  " lg_write = lg_write + 2;\n" \
16528  " buf_pos = (buf_pos + lg_write);\n" \
16529  " /* Ecriture dans le fichier de sortie */\n" \
16530  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
16531  " }\n" \
16532  " }\n" \
16533  "\n" \
16534  " buf_concat[0] = '\\0';\n" \
16535  " doc->cPubPrinc = '5';\n" \
16536  " strcpy(rIamic.acNumobj, \"\");\n" \
16537  " pipe = 0;\n" \
16538  "\n" \
16539  " for (i = 0; i < indice; i++)\n" \
16540  " {\n" \
16541  " /* ajout produits fictifs partenaires */\n" \
16542  " for (x = 0; x < doc[i].value.a_classer.iNbPart; x++)\n" \
16543  " {\n" \
16544  " if (0 == strlen(doc[i].value.a_classer.trpart[x].prod))\n" \
16545  " continue;\n" \
16546  "\n" \
16547  " if (pipe == 0)\n" \
16548  " {\n" \
16549  " strcpy(buf_concat, \"X\");\n" \
16550  " strcat(buf_concat, doc[i].value.a_classer.trpart[x].prod);\n" \
16551  " pipe = 1;\n" \
16552  " }\n" \
16553  " else\n" \
16554  " {\n" \
16555  " strcat(buf_concat, \"|X\");\n" \
16556  " strcat(buf_concat, doc[i].value.a_classer.trpart[x].prod);\n" \
16557  " }\n" \
16558  " }\n" \
16559  " }\n" \
16560  "\n" \
16561  " for (j = 0; j < givrListObj.iNbr; j++)\n" \
16562  " {\n" \
16563  " i = givrListObj.trEltListObj[givrListObj.trEltRangListObj[j]].iRgLigne;\n" \
16564  " x = givrListObj.trEltListObj[givrListObj.trEltRangListObj[j]].iRgObj;\n" \
16565  "\n" \
16566  " if (0 == givrListObj.trEltListObj[givrListObj.trEltRangListObj[j]].iOrdTri)\n" \
16567  " {\n" \
16568  " strcpy(ref_pub, (doc + i)->value.objets_pub.micro[x].type);\n" \
16569  " strcpy(transforme_stype, (doc + i)->value.objets_pub.micro[x].stype);\n" \
16570  "\n" \
16571  " if (transforme_stype[0] == ' ')\n" \
16572  " strcat(ref_pub, &transforme_stype[1]);\n" \
16573  " else\n" \
16574  " strcat(ref_pub, transforme_stype);\n" \
16575  "\n" \
16576  " if ((0 == strcmp((doc + i)->value.objets_pub.micro[x].stype, \"SC\")) && (0 == strcmp((doc + i)->value.objets_pub.micro[x].sstype, \"PB\")))\n" \
16577  " {\n" \
16578  " /* SC-PB */\n" \
16579  " strcat(ref_pub, (doc + i)->value.objets_pub.micro[x].sstype);\n" \
16580  " }\n" \
16581  "\n" \
16582  " if (0 == strlen(buf_concat))\n" \
16583  " strcpy(buf_concat, ref_pub);\n" \
16584  " else if ((0 == strstr(buf_concat, ref_pub)) || (0 == strcmp((doc + i)->value.objets_pub.micro[x].stype, \"SC\")))\n" \
16585  " {\n" \
16586  " if ((int4)strlen(buf_concat) >= ((int4)sizeof(buf_concat) - (int4)strlen(ref_pub) - (int4)1))\n" \
16587  " {\n" \
16588  " /* espace insuffisant */\n" \
16589  " GWTTrace(GWT_NIV_GRAVE, (\"Taille buffer interne produit dépassée epj : %s\\n\", doc->value.a_classer.etab));\n" \
16590  " break;\n" \
16591  " }\n" \
16592  "\n" \
16593  " strcat(buf_concat, \"|\");\n" \
16594  " strcat(buf_concat, ref_pub);\n" \
16595  " }\n" \
16596  "\n" \
16597  " if ((0 == strcmp((doc + i)->value.objets_pub.micro[x].stype, \"SC\")) && (0 == strcmp((doc + i)->value.objets_pub.micro[x].sstype, \"PV\")) && (0 == strlen(rIamic.acNumobj)))\n" \
16598  " {\n" \
16599  " /* SC-PB/SR n'est pas un PVI */\n" \
16600  " strcpy(rIamic.acNumobj, (doc + i)->value.objets_pub.micro[x].id);\n" \
16601  " doc->cPubPrinc = '1';\n" \
16602  " }\n" \
16603  " else if ((0 == strcmp(transforme_stype, \" T\")) && ('2' < doc->cPubPrinc))\n" \
16604  " doc->cPubPrinc = '2';\n" \
16605  " else if ((0 == strcmp(transforme_stype, \"NV\")) && ('3' < doc->cPubPrinc))\n" \
16606  " doc->cPubPrinc = '3';\n" \
16607  " else if ((0 == strcmp(transforme_stype, \"NT\")) && ('4' < doc->cPubPrinc))\n" \
16608  " doc->cPubPrinc = '4';\n" \
16609  " }\n" \
16610  " }\n" \
16611  "\n" \
16612  " for (i = 1; i < indice; i++)\n" \
16613  " (doc + i)->cPubPrinc = doc->cPubPrinc;\n" \
16614  "\n" \
16615  " iCodRet = supprimer_doublon(buf_concat, '|');\n" \
16616  " pt_fin_lst = buf_concat + strlen(buf_concat);\n" \
16617  "\n" \
16618  " for (pt_debut = buf_concat; pt_debut < pt_fin_lst;)\n" \
16619  " {\n" \
16620  " pt_fin = strchr(pt_debut, '|');\n" \
16621  "\n" \
16622  " if (pt_fin == 0)\n" \
16623  " pt_fin = pt_fin_lst;\n" \
16624  "\n" \
16625  " /* analyse client */\n" \
16626  " memcpy(tcProduit, pt_debut, (pt_fin - pt_debut));\n" \
16627  " tcProduit[(pt_fin - pt_debut)] = '\\0';\n" \
16628  " lg_write = giv_ecrit_element(buf_pos, \"pjproduit\", tcProduit);\n" \
16629  " buf_pos = buf_pos + lg_write;\n" \
16630  " pt_debut = pt_fin + 1;\n" \
16631  " }\n" \
16632  "\n" \
16633  " if (0 != strlen(rIamic.acNumobj))\n" \
16634  " {\n" \
16635  " iRet = givLectureImag(&rIamic, tcNbimag, tcImagCat, &tcMenu[0]);\n" \
16636  " tcMenu[1] = '\\0';\n" \
16637  " lg_write = giv_ecrit_balise(buf_pos, tcNbimag, \"nbimag\");\n" \
16638  " buf_pos = buf_pos + lg_write;\n" \
16639  " lg_write = giv_ecrit_balise(buf_pos, tcImagCat, \"imagcat\");\n" \
16640  " buf_pos = buf_pos + lg_write;\n" \
16641  " lg_write = giv_ecrit_balise(buf_pos, tcMenu, \"imagmenu\");\n" \
16642  " buf_pos = buf_pos + lg_write;\n" \
16643  " }\n" \
16644  "\n" \
16645  " /* analyse des produits MA pour UAVS */\n" \
16646  " if ((NULL != strstr(buf_concat, givtcMaxAud)) && (0 != strlen(buf_concat)))\n" \
16647  " {\n" \
16648  " lg_write = giv_ecrit_element(buf_pos, \"rank\", \"2\");\n" \
16649  " buf_pos = buf_pos + lg_write;\n" \
16650  " }\n" \
16651  "\n" \
16652  " /* analyse des Numéros Fréquemment Demandés 95299999 */\n" \
16653  " for (x = 0; (x < givrListParu.iNbr && ((0 != strcmp(givcDepFictif, givrListParu.trEltList[x].dep)) || (0 != strcmp(givcLocFictive, givrListParu.trEltList[x].loc)))); x++)\n" \
16654  " ;\n" \
16655  "\n" \
16656  " if (givrListParu.iNbr != x)\n" \
16657  " {\n" \
16658  " lg_write = giv_ecrit_element(buf_pos, \"rank\", \"1\");\n" \
16659  " buf_pos = buf_pos + lg_write;\n" \
16660  " }\n" \
16661  "\n" \
16662  " /* Ecriture dans le fichier de sortie en UTF8 */\n" \
16663  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
16664  " iRang = -1;\n" \
16665  "\n" \
16666  " for (x = 0; x < indice; x++)\n" \
16667  " {\n" \
16668  " if (iRang != (doc + x)->value.intitule.iRgDnom)\n" \
16669  " {\n" \
16670  " lg_write = giv_ecrit_balise_iso(buf_pos, (doc + x)->value.intitule.denomination, \"denomination\");\n" \
16671  " buf_pos = buf_pos + lg_write;\n" \
16672  " iRang = (doc + x)->value.intitule.iRgDnom;\n" \
16673  " }\n" \
16674  " }\n" \
16675  "\n" \
16676  " /* Ecriture dans le fichier de sortie */\n" \
16677  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
16678  "\n" \
16679  " for (x = 0; x < indice; x++)\n" \
16680  " {\n" \
16681  " for (y = 0; y < x; y++)\n" \
16682  " {\n" \
16683  " if (0 == strcmp((doc + x)->value.rubriques.mogmoi, (doc + y)->value.rubriques.mogmoi))\n" \
16684  " break;\n" \
16685  " }\n" \
16686  "\n" \
16687  " if (y == x)\n" \
16688  " {\n" \
16689  " lg_write = giv_ecrit_balise(buf_pos, (doc + x)->value.rubriques.mogmoi, \"mogmoi\");\n" \
16690  " buf_pos = buf_pos + lg_write;\n" \
16691  " }\n" \
16692  " }\n" \
16693  "\n" \
16694  " for (x = 0; x < indice; x++)\n" \
16695  " {\n" \
16696  " for (y = 0; y < x; y++)\n" \
16697  " {\n" \
16698  " if (0 == strcmp((doc + x)->value.rubriques.mpg, (doc + y)->value.rubriques.mpg))\n" \
16699  " break;\n" \
16700  " }\n" \
16701  "\n" \
16702  " if (y == x)\n" \
16703  " {\n" \
16704  " lg_write = giv_ecrit_balise(buf_pos, (doc + x)->value.rubriques.mpg, \"mpg\");\n" \
16705  " buf_pos = buf_pos + lg_write;\n" \
16706  " }\n" \
16707  " }\n" \
16708  "\n" \
16709  " for (x = 0; x < indice; x++)\n" \
16710  " {\n" \
16711  " for (y = 0; y < x; y++)\n" \
16712  " {\n" \
16713  " if (0 == strcmp((doc + x)->value.rubriques.mendom, (doc + y)->value.rubriques.mendom))\n" \
16714  " break;\n" \
16715  " }\n" \
16716  "\n" \
16717  " if (y == x)\n" \
16718  " {\n" \
16719  " lg_write = giv_ecrit_balise(buf_pos, (doc + x)->value.rubriques.mendom, \"mendom\");\n" \
16720  " buf_pos = buf_pos + lg_write;\n" \
16721  " }\n" \
16722  " }\n" \
16723  "\n" \
16724  " *buf_pos_in = buf_pos;\n" \
16725  " return (iCodRet);\n" \
16726  "} /* Fin ecrire_partie_2_1 */\n" \
16727  "\n" \
16728  "/*----Fonction----------------------------------------------------------------*/\n" \
16729  "/* */\n" \
16730  "/* Fonction : giv_ecrit_partie_2_2 () */\n" \
16731  "/* */\n" \
16732  "/* But : ecrit la partie deux du bloc de parution simple ou groupe */\n" \
16733  "/* possibilite de boucler si cas de Ig ou groupement */\n" \
16734  "/* */\n" \
16735  "/* Entree(s) : un buffer, Structure Document */\n" \
16736  "/* */\n" \
16737  "/* Sortie(s) : OK ou KO */\n" \
16738  "/* */\n" \
16739  "/* Portable : Transparent */\n" \
16740  "/* */\n" \
16741  "/*----------------------------------------------------------------------------*/\n" \
16742  "static int4 giv_ecrit_partie_2_2(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice, GYBrDOCUMENTEpj* docIG, int4 indmax)\n" \
16743  "{\n" \
16744  " int4 lg_write;\n" \
16745  " int4 lg;\n" \
16746  " int4 i, j, k, l, q;\n" \
16747  " char* buf_pos;\n" \
16748  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
16749  " char code_instal[10 + 1];\n" \
16750  " char tcPrecision[2 + 1];\n" \
16751  " char tcBlocid[27 + 1];\n" \
16752  " char datfin[GYBIeinscLgDatmod + 1]; /* date fin */\n" \
16753  " char tcDeplocarr[GYBIeinscLgDeppar + GYBIeinscLgLocpar + GYBIeinscLgArrond + 1];\n" \
16754  " char tcNb[5 + 1]; /* nb de bon plan */\n" \
16755  " int4 iQualite;\n" \
16756  " int4 pipe; /* Flag pour ajout pipe */\n" \
16757  " int4 iRet;\n" \
16758  " int4 iAn9, iRef;\n" \
16759  " char* pt_fin_liste;\n" \
16760  " char* pt_debut_element;\n" \
16761  " char* pt_fin_element;\n" \
16762  " char* pt_mil_element;\n" \
16763  " char* pt_fin_lst;\n" \
16764  " char* pt_debut;\n" \
16765  " char* pt_fin;\n" \
16766  " char tcElmt[29 + 1]; /* partenaire*/\n" \
16767  " GYBrIamicT rIamic;\n" \
16768  " GYBrIadresT rIadres; /* adresse étendue */\n" \
16769  " GYBrIndIadresT rIndIadres;\n" \
16770  " /* Initialisation pointeur */\n" \
16771  " buf_pos = *buf_pos_in;\n" \
16772  " lg_write = giv_ecrit_noeud_inscription(buf_pos, doc, 0);\n" \
16773  " buf_pos = buf_pos + lg_write;\n" \
16774  " /* numéro standard */\n" \
16775  " lg_write = giv_ecrit_balise(buf_pos, \"STD\", \"TypeNum\");\n" \
16776  " buf_pos = buf_pos + lg_write;\n" \
16777  "\n" \
16778  " if (docIG->value.intitule.iRgPrinc == indice)\n" \
16779  " {\n" \
16780  " lg_write = giv_ecrit_balise(buf_pos, doc->value.numero_bloc_parution_ref, \"ippal\");\n" \
16781  " buf_pos = buf_pos + lg_write;\n" \
16782  " }\n" \
16783  "\n" \
16784  " iAn9 = 0;\n" \
16785  "\n" \
16786  " for (i = 0; i < (doc->value.rubriques.iNban9); i++)\n" \
16787  " {\n" \
16788  " if (0 == strcmp(doc->value.rubriques.Tan9[i].val_codan9, givcR00000000))\n" \
16789  " {\n" \
16790  " iAn9 = 1;\n" \
16791  " break;\n" \
16792  " }\n" \
16793  " }\n" \
16794  "\n" \
16795  " if (1 == iAn9)\n" \
16796  " {\n" \
16797  " lg_write = giv_ecrit_balise(buf_pos, \"O\", \"ialpha\");\n" \
16798  " buf_pos = buf_pos + lg_write;\n" \
16799  " }\n" \
16800  "\n" \
16801  " iAn9 = 0;\n" \
16802  "\n" \
16803  " for (i = 0; i < (doc->value.rubriques.iNban9); i++)\n" \
16804  " {\n" \
16805  " if (0 != strcmp(doc->value.rubriques.Tan9[i].val_codan9, givcR00000000))\n" \
16806  " {\n" \
16807  " iAn9 = 1;\n" \
16808  " lg_write = giv_ecrit_balise(buf_pos, doc->value.rubriques.Tan9[i].val_codan9, \"ian9\");\n" \
16809  " buf_pos = buf_pos + lg_write;\n" \
16810  " }\n" \
16811  " }\n" \
16812  "\n" \
16813  " iAn9 = 0;\n" \
16814  "\n" \
16815  " for (i = 0; i < (doc->value.rubriques.iNban9); i++)\n" \
16816  " {\n" \
16817  " if (0 != strcmp(doc->value.rubriques.Tan9[i].val_codan9, givcR00000000))\n" \
16818  " {\n" \
16819  " iAn9 = 1;\n" \
16820  " lg_write = giv_ecrit_balise(buf_pos, doc->value.rubriques.Tan9[i].val_codan8, \"ian8\");\n" \
16821  " buf_pos = buf_pos + lg_write;\n" \
16822  " }\n" \
16823  " }\n" \
16824  "\n" \
16825  " memset(buf_concat, 0, strlen(buf_concat));\n" \
16826  " pipe = 0;\n" \
16827  "\n" \
16828  " for (i = 0; i < (givrListParu.iNbrTot); i++)\n" \
16829  " {\n" \
16830  " j = givrListParu.trEltRangList[i];\n" \
16831  "\n" \
16832  " if (indice == givrListParu.trEltList[j].iRgLigne && 0 != strlen(givrListParu.trEltList[j].rubinit) && 0 != strcmp(givrListParu.trEltList[j].rubinit, givcR000000))\n" \
16833  " {\n" \
16834  " if (pipe == 0)\n" \
16835  " {\n" \
16836  " strcpy(buf_concat, givrListParu.trEltList[j].nature);\n" \
16837  " pipe = 1;\n" \
16838  " }\n" \
16839  " else if ((int4)strlen(buf_concat) < ((int4)sizeof(buf_concat) - (int4)strlen(givtcNatureAn8Part)))\n" \
16840  " {\n" \
16841  " strcat(buf_concat, \"|\");\n" \
16842  " strcat(buf_concat, givrListParu.trEltList[j].nature);\n" \
16843  " }\n" \
16844  " }\n" \
16845  " }\n" \
16846  "\n" \
16847  " GWTTrace(GWT_NIV_FONCT, (\" ipjb2b... %s\\n\", buf_concat));\n" \
16848  " iRet = supprimer_doublon(buf_concat, '|');\n" \
16849  "\n" \
16850  " if (0 != strlen(buf_concat))\n" \
16851  " {\n" \
16852  " lg_write = giv_ecrit_balise(buf_pos, buf_concat, \"ipjb2b\");\n" \
16853  " buf_pos = buf_pos + lg_write;\n" \
16854  " }\n" \
16855  "\n" \
16856  " /* Ecriture dans le fichier de sortie en UTF8 */\n" \
16857  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
16858  " lg_write = giv_ecrit_balise_iso(buf_pos, doc->value.intitule.denomination, \"denomination\");\n" \
16859  " buf_pos = buf_pos + lg_write;\n" \
16860  " lg_write = giv_ecrit_balise_iso(buf_pos, doc->value.intitule.prenom, \"prenom\");\n" \
16861  " buf_pos = buf_pos + lg_write;\n" \
16862  " lg_write = giv_ecrit_balise_iso(buf_pos, doc->value.intitule.initiale, \"iprenom\");\n" \
16863  " buf_pos = buf_pos + lg_write;\n" \
16864  "\n" \
16865  " for (i = 0; i < indmax; i++)\n" \
16866  " {\n" \
16867  " for (j = 0; (j < (docIG + i)->value.rubriques.iNban9 && ('0' == (docIG + i)->value.rubriques.Tan9[j].dnex)); j++)\n" \
16868  " ;\n" \
16869  "\n" \
16870  " if ((docIG + i)->value.rubriques.iNban9 != j)\n" \
16871  " break;\n" \
16872  " }\n" \
16873  "\n" \
16874  " if ((0 == strcmp(givtcInvDenPn, \"NON\")) || (indmax == i))\n" \
16875  " {\n" \
16876  " strcpy(buf_concat, doc->value.intitule.denomination);\n" \
16877  "\n" \
16878  " if (0 != strlen(doc->value.intitule.prenom))\n" \
16879  " {\n" \
16880  " strcat(buf_concat, \" \");\n" \
16881  " strcat(buf_concat, doc->value.intitule.prenom);\n" \
16882  " }\n" \
16883  " }\n" \
16884  " else\n" \
16885  " {\n" \
16886  " /* inversion de l'ordre le la denomination exacte */\n" \
16887  " if (0 != strlen(doc->value.intitule.prenom))\n" \
16888  " {\n" \
16889  " strcpy(buf_concat, doc->value.intitule.prenom);\n" \
16890  " strcat(buf_concat, \" \");\n" \
16891  " strcat(buf_concat, doc->value.intitule.denomination);\n" \
16892  " }\n" \
16893  " else\n" \
16894  " strcpy(buf_concat, doc->value.intitule.denomination);\n" \
16895  " }\n" \
16896  "\n" \
16897  " lg_write = giv_ecrit_balise_iso(buf_pos, buf_concat, \"denomexacte\");\n" \
16898  " buf_pos = buf_pos + lg_write;\n" \
16899  " lg_write = giv_ecrit_balise_iso(buf_pos, doc->value.intitule.complement_denomination, \"icpldenom\");\n" \
16900  " buf_pos = buf_pos + lg_write;\n" \
16901  " lg_write = giv_ecrit_balise_iso(buf_pos, doc->value.inscription[0].moyen_de_com.laqualite, \"iqualite\");\n" \
16902  " buf_pos = buf_pos + lg_write;\n" \
16903  " /* Ecriture dans le fichier de sortie */\n" \
16904  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
16905  " memset(buf_concat, 0, strlen(buf_concat));\n" \
16906  " lg_write = giv_ecrit_noeud(buf_pos, doc->value.inscription[0].adresse.parution, \"adresse\", \"parution\");\n" \
16907  " buf_pos = buf_pos + lg_write;\n" \
16908  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.numero_voie, \"numvoie\");\n" \
16909  " buf_pos = buf_pos + lg_write;\n" \
16910  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.instal, \"codloc\");\n" \
16911  " buf_pos = buf_pos + lg_write;\n" \
16912  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.lib_complt_num_voie, \"libcplnumvoie\");\n" \
16913  " buf_pos = buf_pos + lg_write;\n" \
16914  "\n" \
16915  " if (0 != strlen(doc->value.inscription[0].adresse.code_voie))\n" \
16916  " {\n" \
16917  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.code_voie, \"codvoie\");\n" \
16918  " buf_pos = buf_pos + lg_write;\n" \
16919  " memset(buf_concat, 0, strlen(buf_concat));\n" \
16920  " strcpy(buf_concat, doc->value.inscription[0].adresse.instal);\n" \
16921  " strcat(buf_concat, doc->value.inscription[0].adresse.code_voie);\n" \
16922  " lg_write = giv_ecrit_balise(buf_pos, buf_concat, \"pjcoddeplocvoie\");\n" \
16923  " buf_pos = buf_pos + lg_write;\n" \
16924  " }\n" \
16925  "\n" \
16926  " if (0 != strlen(doc->value.inscription[0].adresse.lib_code_voie))\n" \
16927  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.lib_code_voie, \"libvoie\");\n" \
16928  " else\n" \
16929  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.libel_voie, \"libvoie\");\n" \
16930  "\n" \
16931  " buf_pos = buf_pos + lg_write;\n" \
16932  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.adrnr, \"adrnr\");\n" \
16933  " buf_pos = buf_pos + lg_write;\n" \
16934  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.lieue_ae, \"lieueae\");\n" \
16935  " buf_pos = buf_pos + lg_write;\n" \
16936  "\n" \
16937  " if (((0 == strcmp(GIVtcGeneSSAdr, \"OUI\")) && (givcParuSSAdr == doc->value.intitule.parution[givcIndParuAdr])) || (givcParuSSAdr != doc->value.inscription[0].adresse.parution[givcIndParuAdr]))\n" \
16938  " {\n" \
16939  " memset(buf_concat, 0, strlen(buf_concat));\n" \
16940  " pipe = 0;\n" \
16941  "\n" \
16942  " if (0 != strlen(doc->value.rubriques.arract))\n" \
16943  " {\n" \
16944  " strcpy(buf_concat, doc->value.rubriques.arract);\n" \
16945  " pipe = 1;\n" \
16946  " }\n" \
16947  " else if (0 != strlen(doc->value.inscription[0].adresse.arrondissement))\n" \
16948  " {\n" \
16949  " strcpy(buf_concat, doc->value.inscription[0].adresse.arrondissement);\n" \
16950  " pipe = 1;\n" \
16951  " }\n" \
16952  "\n" \
16953  " /* suppression des doubles arrondissement */\n" \
16954  " iRet = supprimer_doublon(buf_concat, '|');\n" \
16955  " lg_write = giv_ecrit_balise(buf_pos, buf_concat, \"arr\");\n" \
16956  " buf_pos = buf_pos + lg_write;\n" \
16957  " buf_concat[0] = '\\0';\n" \
16958  " memset(buf_concat, 0, strlen(buf_concat));\n" \
16959  " pipe = 0;\n" \
16960  "\n" \
16961  " if (0 != strlen(doc->value.rubriques.arract))\n" \
16962  " {\n" \
16963  " strcpy(buf_concat, doc->value.rubriques.depact);\n" \
16964  " strcat(buf_concat, doc->value.rubriques.locact);\n" \
16965  " strcat(buf_concat, doc->value.rubriques.arract);\n" \
16966  " pipe = 1;\n" \
16967  " }\n" \
16968  " else if (0 != strlen(doc->value.inscription[0].adresse.arrondissement))\n" \
16969  " {\n" \
16970  " strcpy(buf_concat, doc->value.inscription[0].adresse.instal);\n" \
16971  " strcat(buf_concat, doc->value.inscription[0].adresse.arrondissement);\n" \
16972  " pipe = 1;\n" \
16973  " }\n" \
16974  "\n" \
16975  " /* suppression des doubles arrondissement */\n" \
16976  " iRet = supprimer_doublon(buf_concat, '|');\n" \
16977  " lg_write = giv_ecrit_balise(buf_pos, buf_concat, \"arrinst\");\n" \
16978  " buf_pos = buf_pos + lg_write;\n" \
16979  " }\n" \
16980  "\n" \
16981  " buf_concat[0] = '\\0';\n" \
16982  " pipe = 0;\n" \
16983  "\n" \
16984  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
16985  " {\n" \
16986  " l = givrListParu.trEltRangList[j];\n" \
16987  "\n" \
16988  " if (((int4)GIV::GIXCodeKO == givrListParu.trEltList[l].iLF) && (99 != givrListParu.trEltList[l].iGeoArr))\n" \
16989  " {\n" \
16990  " strcpy(tcDeplocarr, givrListParu.trEltList[l].dep);\n" \
16991  " strcat(tcDeplocarr, givrListParu.trEltList[l].loc);\n" \
16992  " strcat(tcDeplocarr, givrListParu.trEltList[l].arr);\n" \
16993  "\n" \
16994  " if (sizeof(buf_concat) < (strlen(buf_concat) + strlen(tcDeplocarr)))\n" \
16995  " {\n" \
16996  " /* Trop d'entrées internes */\n" \
16997  " GWTTrace(GWT_NIV_GRAVE, (\"Taille buffer interne dépassée\\n\"));\n" \
16998  " break;\n" \
16999  " }\n" \
17000  "\n" \
17001  " if (pipe == 0)\n" \
17002  " {\n" \
17003  " strcpy(buf_concat, tcDeplocarr);\n" \
17004  " pipe = 1;\n" \
17005  " }\n" \
17006  " else if (0 == strstr(buf_concat, tcDeplocarr))\n" \
17007  " {\n" \
17008  " strcat(buf_concat, \"|\");\n" \
17009  " strcat(buf_concat, tcDeplocarr);\n" \
17010  " }\n" \
17011  " }\n" \
17012  " }\n" \
17013  "\n" \
17014  " /* suppression des doubles arrondissement */\n" \
17015  " iRet = supprimer_doublon(buf_concat, '|');\n" \
17016  "\n" \
17017  " if (0 != strlen(buf_concat))\n" \
17018  " {\n" \
17019  " pt_fin_lst = buf_concat + strlen(buf_concat);\n" \
17020  "\n" \
17021  " for (pt_debut = buf_concat; pt_debut < pt_fin_lst;)\n" \
17022  " {\n" \
17023  " pt_fin = strchr(pt_debut, '|');\n" \
17024  "\n" \
17025  " if (pt_fin == 0)\n" \
17026  " pt_fin = pt_fin_lst;\n" \
17027  "\n" \
17028  " /* analyse rub */\n" \
17029  " memcpy(code_instal, pt_debut, (pt_fin - pt_debut));\n" \
17030  " code_instal[(pt_fin - pt_debut)] = '\\0';\n" \
17031  " lg_write = giv_ecrit_element(buf_pos, \"arrpar\", code_instal);\n" \
17032  " buf_pos = buf_pos + lg_write;\n" \
17033  " pt_debut = pt_fin + 1;\n" \
17034  " }\n" \
17035  " }\n" \
17036  "\n" \
17037  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.libinstal, \"libloc\");\n" \
17038  " buf_pos = buf_pos + lg_write;\n" \
17039  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.libinstact, \"liblocact\");\n" \
17040  " buf_pos = buf_pos + lg_write;\n" \
17041  " iRet = givLectureLibLocAtt(&buf_pos, doc->value.inscription[0].adresse.instal, doc->value.a_classer.etab);\n" \
17042  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.code_postal, \"cp\");\n" \
17043  " buf_pos = buf_pos + lg_write;\n" \
17044  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.code_cedex, \"cedex\");\n" \
17045  " buf_pos = buf_pos + lg_write;\n" \
17046  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.lib_cedex, \"libcedex\");\n" \
17047  " buf_pos = buf_pos + lg_write;\n" \
17048  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.boite, \"bp\");\n" \
17049  " buf_pos = buf_pos + lg_write;\n" \
17050  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.ipays, \"ipays\");\n" \
17051  " buf_pos = buf_pos + lg_write;\n" \
17052  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.ensemble_batiment, \"bat\");\n" \
17053  " buf_pos = buf_pos + lg_write;\n" \
17054  " buf_concat[0] = '\\0';\n" \
17055  " i = 0;\n" \
17056  "\n" \
17057  " if ((givcParuSSAdr != doc->value.intitule.parution[givcIndParuAdr]) || ((0 == strcmp(GIVtcGeneSSAdr, \"OUI\")) && (givcParuSSAdr == doc->value.intitule.parution[givcIndParuAdr])))\n" \
17058  " {\n" \
17059  " /* Adresse étendue */\n" \
17060  " (void)strcpy(rIadres.acNumnat, doc->value.inscription[0].val_num);\n" \
17061  " (void)strcpy(rIadres.acNumlo, doc->value.inscription[0].val_lo);\n" \
17062  " (void)strcpy(rIadres.acNumls, doc->value.inscription[0].val_ls);\n" \
17063  " iRet = GIVLectureLectureIADRES(&rIadres, &rIndIadres);\n" \
17064  "\n" \
17065  " if ((int4)GIV::GIXCodeOK == iRet)\n" \
17066  " {\n" \
17067  " lg_write = giv_ecrit_balise(buf_pos, rIadres.acCodReg, \"coderegion\");\n" \
17068  " buf_pos = buf_pos + lg_write;\n" \
17069  " lg_write = giv_ecrit_balise(buf_pos, rIadres.acLibDep, \"libdep\");\n" \
17070  " buf_pos = buf_pos + lg_write;\n" \
17071  " lg_write = giv_ecrit_balise(buf_pos, rIadres.acLibReg, \"libregion\");\n" \
17072  " buf_pos = buf_pos + lg_write;\n" \
17073  " lg_write = giv_ecrit_balise(buf_pos, rIadres.acTypVoiEtendu, \"typevoieetendu\");\n" \
17074  " buf_pos = buf_pos + lg_write;\n" \
17075  " lg_write = giv_ecrit_balise(buf_pos, rIadres.acLibVoiEtendu, \"libvoietendu\");\n" \
17076  " buf_pos = buf_pos + lg_write;\n" \
17077  " lg_write = giv_ecrit_balise(buf_pos, rIadres.acLigne2Etendu, \"ligne2Etendu\");\n" \
17078  " buf_pos = buf_pos + lg_write;\n" \
17079  " lg_write = giv_ecrit_balise(buf_pos, rIadres.acLigne3Etendu, \"ligne3Etendu\");\n" \
17080  " buf_pos = buf_pos + lg_write;\n" \
17081  " lg_write = giv_ecrit_balise(buf_pos, rIadres.acLigne5Etendu, \"ligne5Etendu\");\n" \
17082  " buf_pos = buf_pos + lg_write;\n" \
17083  " }\n" \
17084  "\n" \
17085  " strcat(buf_concat, doc->value.inscription[0].adresse.ensemble_batiment);\n" \
17086  "\n" \
17087  " if (givcParuSSNoParu != doc->value.intitule.parution[givcIndParuNoParu])\n" \
17088  " {\n" \
17089  " if (0 != strlen(doc->value.inscription[0].adresse.numero_voie))\n" \
17090  " {\n" \
17091  " strcat(buf_concat, \" \");\n" \
17092  " strcat(buf_concat, doc->value.inscription[0].adresse.numero_voie);\n" \
17093  " }\n" \
17094  "\n" \
17095  " if (0 != strlen(doc->value.inscription[0].adresse.lib_complt_num_voie))\n" \
17096  " {\n" \
17097  " strcat(buf_concat, \" \");\n" \
17098  " strcat(buf_concat, doc->value.inscription[0].adresse.lib_complt_num_voie);\n" \
17099  " }\n" \
17100  " }\n" \
17101  "\n" \
17102  " if (0 != strlen(doc->value.inscription[0].adresse.lib_code_voie))\n" \
17103  " {\n" \
17104  " strcat(buf_concat, \" \");\n" \
17105  " strcat(buf_concat, doc->value.inscription[0].adresse.lib_code_voie);\n" \
17106  " }\n" \
17107  " else if (0 != strlen(doc->value.inscription[0].adresse.libel_voie))\n" \
17108  " {\n" \
17109  " strcat(buf_concat, \" \");\n" \
17110  " strcat(buf_concat, doc->value.inscription[0].adresse.libel_voie);\n" \
17111  " }\n" \
17112  " else if (0 != strlen(doc->value.inscription[0].adresse.adrnr))\n" \
17113  " {\n" \
17114  " strcat(buf_concat, \" \");\n" \
17115  " strcat(buf_concat, doc->value.inscription[0].adresse.adrnr);\n" \
17116  " }\n" \
17117  "\n" \
17118  " if (0 != strlen(doc->value.inscription[0].adresse.lieue_ae))\n" \
17119  " {\n" \
17120  " strcat(buf_concat, \" \");\n" \
17121  " strcat(buf_concat, doc->value.inscription[0].adresse.lieue_ae);\n" \
17122  " }\n" \
17123  "\n" \
17124  " if (0 != strlen(doc->value.inscription[0].adresse.boite))\n" \
17125  " {\n" \
17126  " strcat(buf_concat, \" BP \");\n" \
17127  " strcat(buf_concat, doc->value.inscription[0].adresse.boite);\n" \
17128  " }\n" \
17129  "\n" \
17130  " if (0 != strlen(doc->value.inscription[0].adresse.code_cedex))\n" \
17131  " {\n" \
17132  " strcat(buf_concat, \" \");\n" \
17133  " strcat(buf_concat, doc->value.inscription[0].adresse.code_cedex);\n" \
17134  " }\n" \
17135  " else if (0 != strlen(doc->value.inscription[0].adresse.code_postal))\n" \
17136  " {\n" \
17137  " if ((0 == strcmp(doc->value.inscription[0].val_ls, \"0000\")) || ((0 == strcmp(GIVtcGeneCP, \"OUI\")) && (0 != strcmp(doc->value.inscription[0].val_ls, \"0000\"))))\n" \
17138  " {\n" \
17139  " strcat(buf_concat, \" \");\n" \
17140  " strcat(buf_concat, doc->value.inscription[0].adresse.code_postal);\n" \
17141  " }\n" \
17142  " }\n" \
17143  "\n" \
17144  " if (0 == strcmp(doc->value.inscription[0].val_ls, \"0000\"))\n" \
17145  " {\n" \
17146  " if (0 != strlen(doc->value.inscription[0].adresse.lib_cedex))\n" \
17147  " {\n" \
17148  " strcat(buf_concat, \" \");\n" \
17149  " strcat(buf_concat, doc->value.inscription[0].adresse.lib_cedex);\n" \
17150  " }\n" \
17151  " else if (0 != strlen(doc->value.inscription[0].adresse.libinstal))\n" \
17152  " {\n" \
17153  " strcat(buf_concat, \" \");\n" \
17154  " strcat(buf_concat, doc->value.inscription[0].adresse.libinstal);\n" \
17155  " }\n" \
17156  " }\n" \
17157  "\n" \
17158  " if (((0 != strlen(doc->value.inscription[0].adresse.lib_code_voie)) || (0 != strlen(doc->value.inscription[0].adresse.libel_voie))) && (0 != strlen(doc->value.inscription[0].adresse.adrnr))\n" \
17159  " && (0 != strcmp(doc->value.inscription[0].val_ls, \"0000\")))\n" \
17160  " {\n" \
17161  " strcat(buf_concat, \" \");\n" \
17162  " strcat(buf_concat, doc->value.inscription[0].adresse.adrnr);\n" \
17163  " }\n" \
17164  "\n" \
17165  " for (i = 0; (i < strlen(buf_concat) && ' ' == buf_concat[i]); i++)\n" \
17166  " ;\n" \
17167  " }\n" \
17168  "\n" \
17169  " lg_write = giv_ecrit_balise(buf_pos, &buf_concat[i], \"adressekm\");\n" \
17170  " buf_pos = buf_pos + lg_write;\n" \
17171  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"geoloc\");\n" \
17172  " buf_pos = buf_pos + lg_write;\n" \
17173  "\n" \
17174  " if (((0 == strcmp(doc->value.inscription[0].adresse.geoloc.precision, \"00\")) || (0 == strcmp(doc->value.inscription[0].adresse.geoloc.precision, \"04\"))\n" \
17175  " || (0 == strcmp(doc->value.inscription[0].adresse.geoloc.precision, \"99\")) || (0 == strcmp(doc->value.inscription[0].adresse.geoloc.precision, \"97\")\n" \
17176  " && givcParuAdr == doc->value.intitule.parution[givcIndParuAdr])) && (0 == strcmp(doc->value.inscription[0].adresse.centreloc.precision, \"0\")))\n" \
17177  " {\n" \
17178  " strcpy(doc->value.inscription[0].adresse.geoloc.precision, \"00\");\n" \
17179  " strcpy(doc->value.inscription[0].adresse.geoloc.longitude, doc->value.inscription[0].adresse.centreloc.longitude);\n" \
17180  " strcpy(doc->value.inscription[0].adresse.geoloc.latitude, doc->value.inscription[0].adresse.centreloc.latitude);\n" \
17181  " }\n" \
17182  "\n" \
17183  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.geoloc.longitude, \"long\");\n" \
17184  " buf_pos = buf_pos + lg_write;\n" \
17185  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.geoloc.latitude, \"lat\");\n" \
17186  " buf_pos = buf_pos + lg_write;\n" \
17187  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.centreloc.precision, \"prcnt\");\n" \
17188  " buf_pos = buf_pos + lg_write;\n" \
17189  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.centreloc.longitude, \"longcnt\");\n" \
17190  " buf_pos = buf_pos + lg_write;\n" \
17191  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.centreloc.latitude, \"latcnt\");\n" \
17192  " buf_pos = buf_pos + lg_write;\n" \
17193  " iQualite = atoi(doc->value.inscription[0].adresse.geoloc.precision);\n" \
17194  "\n" \
17195  " if (50 == iQualite)\n" \
17196  " {\n" \
17197  " /* précision forçée au centre de la localité */\n" \
17198  " lg_write = giv_ecrit_balise(buf_pos, \"1\", \"forccnt\");\n" \
17199  " buf_pos = buf_pos + lg_write;\n" \
17200  " iQualite = 0;\n" \
17201  " strcpy(doc->value.inscription[0].adresse.geoloc.precision, \"00\");\n" \
17202  " }\n" \
17203  " else if (51 == iQualite)\n" \
17204  " {\n" \
17205  " /* précision indiquant une inversion longitude et latitude */\n" \
17206  " lg_write = giv_ecrit_balise(buf_pos, \"1\", \"forccnt\");\n" \
17207  " buf_pos = buf_pos + lg_write;\n" \
17208  " iQualite = 3;\n" \
17209  " strcpy(doc->value.inscription[0].adresse.geoloc.precision, \"03\");\n" \
17210  " }\n" \
17211  "\n" \
17212  " doc->iDblGeoLoc = GIV::giv_EXTL;\n" \
17213  "\n" \
17214  " if (GIV::giv_LOC == doc->iGeoLoc)\n" \
17215  " {\n" \
17216  " /* inscription locale ou avec un double local */\n" \
17217  " doc->iDblGeoLoc = GIV::giv_LOC;\n" \
17218  " GWTTrace(GWT_NIV_FONCT, (\"test extraloc doc : %d\\n\", doc->iDblGeoLoc));\n" \
17219  " }\n" \
17220  " else\n" \
17221  " {\n" \
17222  " for (j = 0; j < givrListParu.iNbrTot; j++)\n" \
17223  " {\n" \
17224  " q = givrListParu.trEltRangList[j];\n" \
17225  "\n" \
17226  " if (GIV::giv_LOC == givrListParu.trEltList[q].iGeoLoc)\n" \
17227  " {\n" \
17228  " /* inscription locale via les autres parutions */\n" \
17229  " doc->iDblGeoLoc = GIV::giv_LOC;\n" \
17230  " GWTTrace(GWT_NIV_FONCT, (\"test extraloc dbl : %d\\n\", doc->iDblGeoLoc));\n" \
17231  " break;\n" \
17232  " }\n" \
17233  " }\n" \
17234  " }\n" \
17235  "\n" \
17236  " GWTTrace(GWT_NIV_FONCT, (\"test extraloc: %d,%d\\n\", doc->iDblGeoLoc, iAn9));\n" \
17237  "\n" \
17238  " switch (iQualite)\n" \
17239  " {\n" \
17240  " case 97:\n" \
17241  " case 99:\n" \
17242  " break;\n" \
17243  "\n" \
17244  " case 96:\n" \
17245  " case 98:\n" \
17246  " lg_write = giv_ecrit_balise(buf_pos, \"04\", \"precision\");\n" \
17247  " buf_pos = buf_pos + lg_write;\n" \
17248  " lg_write = giv_ecrit_balise(buf_pos, \"1\", \"srcprecision\");\n" \
17249  " buf_pos = buf_pos + lg_write;\n" \
17250  " break;\n" \
17251  "\n" \
17252  " default:\n" \
17253  " iQualite = iQualite % 4;\n" \
17254  " (void)sprintf(&tcPrecision[0], \"%02d\", iQualite);\n" \
17255  " lg_write = giv_ecrit_balise(buf_pos, tcPrecision, \"precision\");\n" \
17256  " buf_pos = buf_pos + lg_write;\n" \
17257  "\n" \
17258  " if (GIV::giv_LOC == doc->iDblGeoLoc)\n" \
17259  " {\n" \
17260  " if ((0 != strlen(doc->value.a_classer.etab)) && (0 == strcmp(doc->value.inscription[0].val_ls, \"0000\")) && (0 != iAn9))\n" \
17261  " {\n" \
17262  " GWTTrace(GWT_NIV_FONCT, (\"Extra Loc IO %s,%s,%s,%s\\n\", doc->value.a_classer.etab, doc->value.inscription[0].val_num, doc->value.inscription[0].val_lo, doc->value.inscription[0].val_ls));\n" \
17263  " iRet = givExtraLocIO(doc);\n" \
17264  "\n" \
17265  " if ((int4)GIV::GIXCodeOK == iRet)\n" \
17266  " {\n" \
17267  " /* existence d'autre locale pour IO locale */\n" \
17268  " lg_write = giv_ecrit_balise(buf_pos, tcPrecision, \"prloc\");\n" \
17269  " buf_pos = buf_pos + lg_write;\n" \
17270  " }\n" \
17271  " }\n" \
17272  " else\n" \
17273  " {\n" \
17274  " lg_write = giv_ecrit_balise(buf_pos, tcPrecision, \"prloc\");\n" \
17275  " buf_pos = buf_pos + lg_write;\n" \
17276  " }\n" \
17277  " }\n" \
17278  "\n" \
17279  " if ((0 != strlen(doc->value.a_classer.etab)) && (GIV::giv_LOC != doc->iDblGeoLoc) && (0 != iAn9))\n" \
17280  " {\n" \
17281  " buf_concat[0] = '\\0';\n" \
17282  "\n" \
17283  " for (i = 0; i < (givrListParu.iNbrTot); i++)\n" \
17284  " {\n" \
17285  " j = givrListParu.trEltRangList[i];\n" \
17286  "\n" \
17287  " if (indice == givrListParu.trEltList[j].iRgLigne && 0 != strlen(givrListParu.trEltList[j].rubinit) &&\n" \
17288  " NULL == strstr(buf_concat, givrListParu.trEltList[j].rubinit))\n" \
17289  " {\n" \
17290  " iRet = givExtraLocIS(doc->value.a_classer.etab, givrListParu.trEltList[j].rubinit);\n" \
17291  "\n" \
17292  " if ((int4)GIV::GIXCodeOK != iRet)\n" \
17293  " {\n" \
17294  " /* absence de locale pour IS/IO non locale */\n" \
17295  " GWTTrace(GWT_NIV_FONCT, (\"Extra Loc IS %s,%s\\n\", doc->value.a_classer.etab, givrListParu.trEltList[j].rubinit));\n" \
17296  " break;\n" \
17297  " }\n" \
17298  "\n" \
17299  " if (0 == strlen(buf_concat))\n" \
17300  " strcpy(buf_concat, givrListParu.trEltList[j].rubinit);\n" \
17301  " else\n" \
17302  " {\n" \
17303  " strcat(buf_concat, \"|\");\n" \
17304  " strcat(buf_concat, givrListParu.trEltList[j].rubinit);\n" \
17305  " }\n" \
17306  " }\n" \
17307  " }\n" \
17308  "\n" \
17309  " if (i != givrListParu.iNbrTot)\n" \
17310  " {\n" \
17311  " /* absence de locale pour un an8 */\n" \
17312  " GWTTrace(GWT_NIV_FONCT, (\"Prloc IS... %s\\n\", givrListParu.trEltList[j].rubinit));\n" \
17313  " lg_write = giv_ecrit_balise(buf_pos, tcPrecision, \"prloc\");\n" \
17314  " buf_pos = buf_pos + lg_write;\n" \
17315  " }\n" \
17316  " }\n" \
17317  "\n" \
17318  " iQualite = atoi(doc->value.inscription[0].adresse.geoloc.precision);\n" \
17319  " iQualite = iQualite / 4;\n" \
17320  " (void)sprintf(&tcPrecision[0], \"%d\", iQualite);\n" \
17321  " lg_write = giv_ecrit_balise(buf_pos, tcPrecision, \"srcprecision\");\n" \
17322  " buf_pos = buf_pos + lg_write;\n" \
17323  " break;\n" \
17324  " }\n" \
17325  "\n" \
17326  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.geoloc.precMappy, \"precisionMappy\");\n" \
17327  " buf_pos = buf_pos + lg_write;\n" \
17328  "\n" \
17329  " if (0 != strlen(doc->value.inscription[0].adresse.geoloc.longitude))\n" \
17330  " {\n" \
17331  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"carte\");\n" \
17332  " buf_pos = buf_pos + lg_write;\n" \
17333  " lg_write = giv_ecrit_balise(buf_pos, doc->value.numero_bloc_parution, \"ctebloc\");\n" \
17334  " buf_pos = buf_pos + lg_write;\n" \
17335  " /* Ecriture dans le fichier de sortie en UTF8 */\n" \
17336  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
17337  " lg_write = giv_ecrit_balise_iso(buf_pos, doc->value.intitule.denomination, \"ctedenom\");\n" \
17338  " buf_pos = buf_pos + lg_write;\n" \
17339  " /* Ecriture dans le fichier de sortie */\n" \
17340  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
17341  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.geoloc.longitude, \"ctelong\");\n" \
17342  " buf_pos = buf_pos + lg_write;\n" \
17343  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].adresse.geoloc.latitude, \"ctelat\");\n" \
17344  " buf_pos = buf_pos + lg_write;\n" \
17345  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"carte\");\n" \
17346  " buf_pos = buf_pos + lg_write;\n" \
17347  " }\n" \
17348  "\n" \
17349  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"geoloc\");\n" \
17350  " buf_pos = buf_pos + lg_write;\n" \
17351  " /* Fin de l'entité adresse */\n" \
17352  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"adresse\");\n" \
17353  " buf_pos = buf_pos + lg_write;\n" \
17354  "\n" \
17355  " /* Entête pour moyen de communication */\n" \
17356  " if (('0' != doc->cIndPart) && (0 == strlen(doc->value.inscription[0].moyen_de_com.numero_parution)))\n" \
17357  " {\n" \
17358  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"moycom/\");\n" \
17359  " buf_pos = buf_pos + lg_write;\n" \
17360  " }\n" \
17361  " else\n" \
17362  " {\n" \
17363  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"moycom\");\n" \
17364  " buf_pos = buf_pos + lg_write;\n" \
17365  " /* Ecriture dans le fichier de sortie en UTF8 */\n" \
17366  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
17367  " lg_write = giv_ecrit_balise_iso(buf_pos, doc->value.inscription[0].moyen_de_com.designation_ligne, \"desligne\");\n" \
17368  " buf_pos = buf_pos + lg_write;\n" \
17369  "\n" \
17370  " if ('\\0' != GIVBuffXML[0])\n" \
17371  " {\n" \
17372  " /* Ecriture dans le fichier de sortie */\n" \
17373  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
17374  " }\n" \
17375  "\n" \
17376  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.numero, \"num\");\n" \
17377  " buf_pos = buf_pos + lg_write;\n" \
17378  "\n" \
17379  " switch (doc->value.intitule.protection[0])\n" \
17380  " {\n" \
17381  " case '1':\n" \
17382  " lg_write = giv_ecrit_balise(buf_pos, \"rouge\", \"protection\");\n" \
17383  " break;\n" \
17384  "\n" \
17385  " case '2':\n" \
17386  " lg_write = giv_ecrit_balise(buf_pos, \"orange\", \"protection\");\n" \
17387  " break;\n" \
17388  "\n" \
17389  " case '3':\n" \
17390  " lg_write = giv_ecrit_balise(buf_pos, \"rouge|orange\", \"protection\");\n" \
17391  " break;\n" \
17392  "\n" \
17393  " case '4':\n" \
17394  " lg_write = giv_ecrit_balise(buf_pos, \"safran\", \"protection\");\n" \
17395  " break;\n" \
17396  "\n" \
17397  " case '5':\n" \
17398  " lg_write = giv_ecrit_balise(buf_pos, \"rouge|safran\", \"protection\");\n" \
17399  " break;\n" \
17400  "\n" \
17401  " case '6':\n" \
17402  " lg_write = giv_ecrit_balise(buf_pos, \"orange|safran\", \"protection\");\n" \
17403  " break;\n" \
17404  "\n" \
17405  " case '7':\n" \
17406  " lg_write = giv_ecrit_balise(buf_pos, \"rouge|orange|safran\", \"protection\");\n" \
17407  " break;\n" \
17408  "\n" \
17409  " case 'A':\n" \
17410  " lg_write = giv_ecrit_balise(buf_pos, \"noninverse\", \"protection\");\n" \
17411  " break;\n" \
17412  "\n" \
17413  " case 'B':\n" \
17414  " lg_write = giv_ecrit_balise(buf_pos, \"orange|noninverse\", \"protection\");\n" \
17415  " break;\n" \
17416  "\n" \
17417  " case 'C':\n" \
17418  " lg_write = giv_ecrit_balise(buf_pos, \"safran|noninverse\", \"protection\");\n" \
17419  " break;\n" \
17420  "\n" \
17421  " case 'D':\n" \
17422  " lg_write = giv_ecrit_balise(buf_pos, \"orange|safran|noninverse\", \"protection\");\n" \
17423  " break;\n" \
17424  "\n" \
17425  " default:\n" \
17426  " lg_write = 0;\n" \
17427  " break;\n" \
17428  " }\n" \
17429  "\n" \
17430  " buf_pos = buf_pos + lg_write;\n" \
17431  "\n" \
17432  " switch (doc->value.intitule.support[0])\n" \
17433  " {\n" \
17434  " case givcSuppCham:\n" \
17435  " lg_write = giv_ecrit_balise(buf_pos, \"chamois\", \"support\");\n" \
17436  " break;\n" \
17437  "\n" \
17438  " default:\n" \
17439  " lg_write = 0;\n" \
17440  " break;\n" \
17441  " }\n" \
17442  "\n" \
17443  " buf_pos = buf_pos + lg_write;\n" \
17444  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.numero_parution, \"numpar\");\n" \
17445  " buf_pos = buf_pos + lg_write;\n" \
17446  " j = 0;\n" \
17447  " iRef = -1;\n" \
17448  "\n" \
17449  " if (0 != strlen(doc->value.inscription[0].moyen_de_com.numero_parution))\n" \
17450  " {\n" \
17451  " for (i = 0; i < strlen(doc->value.inscription[0].moyen_de_com.numero_parution); i++)\n" \
17452  " {\n" \
17453  " if (' ' == doc->value.inscription[0].moyen_de_com.numero_parution[i])\n" \
17454  " iRef = i;\n" \
17455  " else if ((iRef + 1 == i) && (-1 != iRef) && (0 == isdigit(doc->value.inscription[0].moyen_de_com.numero_parution[i])) && (0 != isdigit(doc->value.inscription[0].moyen_de_com.numero_parution[0])))\n" \
17456  " {\n" \
17457  " doc->value.inscription[0].moyen_de_com.numero_parution[iRef] = '\\0';\n" \
17458  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.numero_parution, \"numpartel\");\n" \
17459  " buf_pos = buf_pos + lg_write;\n" \
17460  " doc->value.inscription[0].moyen_de_com.numero_parution[iRef] = ' ';\n" \
17461  " lg_write = giv_ecrit_balise(buf_pos, &doc->value.inscription[0].moyen_de_com.numero_parution[iRef + 1], \"numparmagique\");\n" \
17462  " buf_pos = buf_pos + lg_write;\n" \
17463  " break;\n" \
17464  " }\n" \
17465  " }\n" \
17466  "\n" \
17467  " if (strlen(doc->value.inscription[0].moyen_de_com.numero_parution) == i)\n" \
17468  " {\n" \
17469  " if (0 != isdigit(doc->value.inscription[0].moyen_de_com.numero_parution[0]))\n" \
17470  " {\n" \
17471  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.numero_parution, \"numpartel\");\n" \
17472  " buf_pos = buf_pos + lg_write;\n" \
17473  " }\n" \
17474  " else\n" \
17475  " {\n" \
17476  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.numero_parution, \"numparmagique\");\n" \
17477  " buf_pos = buf_pos + lg_write;\n" \
17478  " }\n" \
17479  " }\n" \
17480  " }\n" \
17481  "\n" \
17482  " j = 0;\n" \
17483  "\n" \
17484  " if (0 != strlen(doc->value.inscription[0].moyen_de_com.numero_parution))\n" \
17485  " {\n" \
17486  " for (i = 0; i < strlen(doc->value.inscription[0].moyen_de_com.numero_parution); i++)\n" \
17487  " {\n" \
17488  " if (0 != isdigit(doc->value.inscription[0].moyen_de_com.numero_parution[i]))\n" \
17489  " {\n" \
17490  " buf_concat[j] = doc->value.inscription[0].moyen_de_com.numero_parution[i];\n" \
17491  " j++;\n" \
17492  " }\n" \
17493  " }\n" \
17494  " }\n" \
17495  " else\n" \
17496  " {\n" \
17497  " for (i = 0; i < strlen(doc->value.inscription[0].moyen_de_com.numero); i++)\n" \
17498  " {\n" \
17499  " if (0 != isdigit(doc->value.inscription[0].moyen_de_com.numero[i]))\n" \
17500  " {\n" \
17501  " buf_concat[j] = doc->value.inscription[0].moyen_de_com.numero[i];\n" \
17502  " j++;\n" \
17503  " }\n" \
17504  " }\n" \
17505  " }\n" \
17506  "\n" \
17507  " buf_concat[j] = '\\0';\n" \
17508  " lg_write = giv_ecrit_balise(buf_pos, buf_concat, \"numinverse\");\n" \
17509  " buf_pos = buf_pos + lg_write;\n" \
17510  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.code_produit, \"codpro\");\n" \
17511  " buf_pos = buf_pos + lg_write;\n" \
17512  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.code_produit_etd, \"codproetendu\");\n" \
17513  " buf_pos = buf_pos + lg_write;\n" \
17514  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.catnum, \"catnumero\");\n" \
17515  " buf_pos = buf_pos + lg_write;\n" \
17516  "\n" \
17517  " if ((NULL != strstr(doc->value.inscription[0].moyen_de_com.code_produit, givtcAnMes)) && (0 != strlen(doc->value.inscription[0].moyen_de_com.code_produit)))\n" \
17518  " {\n" \
17519  " lg_write = giv_ecrit_balise(buf_pos, \"AM\", \"indic\");\n" \
17520  " buf_pos = buf_pos + lg_write;\n" \
17521  " }\n" \
17522  "\n" \
17523  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.equiptel, \"equiptel\");\n" \
17524  " buf_pos = buf_pos + lg_write;\n" \
17525  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.servtel, \"servtel\");\n" \
17526  " buf_pos = buf_pos + lg_write;\n" \
17527  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.tarifart, \"tarifart\");\n" \
17528  " buf_pos = buf_pos + lg_write;\n" \
17529  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.operateur, \"operateur\");\n" \
17530  " buf_pos = buf_pos + lg_write;\n" \
17531  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.email, \"email\");\n" \
17532  " buf_pos = buf_pos + lg_write;\n" \
17533  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.mnemonique, \"mnemonique\");\n" \
17534  " buf_pos = buf_pos + lg_write;\n" \
17535  " /* Ecriture dans le fichier de sortie */\n" \
17536  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
17537  " /* conversion spécifique euro pour mention tarifaire */\n" \
17538  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.tarif_exact, \"tarif\");\n" \
17539  " buf_pos = buf_pos + lg_write;\n" \
17540  " /* Conversion du buffer avant écriture dans le fichier */\n" \
17541  " givTradChar(&lg_write);\n" \
17542  " /* Conversion euro */\n" \
17543  " memcpy(GIVBuffInter, GIVBuffXML, strlen(GIVBuffXML));\n" \
17544  " gwtRemplaceChaine(GIVBuffInter, GXW_cg_Euro, GXW_utf8_Euro, GIVBuffXML);\n" \
17545  " /* écriture dans le fichier */\n" \
17546  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
17547  " /* Fin de l'entité moyen_de_communication */\n" \
17548  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"moycom\");\n" \
17549  " buf_pos = buf_pos + lg_write;\n" \
17550  " }\n" \
17551  "\n" \
17552  " if (0 != strlen(doc->value.inscription[0].moyen_de_com.cteutil))\n" \
17553  " {\n" \
17554  " /* Entête pour cu */\n" \
17555  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"cu\");\n" \
17556  " buf_pos = buf_pos + lg_write;\n" \
17557  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.cteutil, \"idutil\");\n" \
17558  " buf_pos = buf_pos + lg_write;\n" \
17559  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.datcu, \"cudate\");\n" \
17560  " buf_pos = buf_pos + lg_write;\n" \
17561  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.nomsupplement, \"nomsf\");\n" \
17562  " buf_pos = buf_pos + lg_write;\n" \
17563  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.msknum, \"indmasknum\");\n" \
17564  " buf_pos = buf_pos + lg_write;\n" \
17565  " lg_write = giv_ecrit_balise(buf_pos, doc->value.inscription[0].moyen_de_com.mskmel, \"indmaskemail\");\n" \
17566  " buf_pos = buf_pos + lg_write;\n" \
17567  " /* Fin de l'entité compte utilisateur */\n" \
17568  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"cu\");\n" \
17569  " buf_pos = buf_pos + lg_write;\n" \
17570  " }\n" \
17571  "\n" \
17572  " *buf_pos_in = buf_pos;\n" \
17573  " return (iCodRet);\n" \
17574  "} /* Fin ecrire_partie_2_2 */\n" \
17575  "\n" \
17576  "/*----Fonction----------------------------------------------------------------*/\n" \
17577  "/* */\n" \
17578  "/* Fonction : giv_ecrit_partie_2_3 () */\n" \
17579  "/* */\n" \
17580  "/* But : ecrit la partie deux du bloc de parution simple ou groupe */\n" \
17581  "/* */\n" \
17582  "/* */\n" \
17583  "/* Entree(s) : un buffer, Structure Document */\n" \
17584  "/* */\n" \
17585  "/* Sortie(s) : OK ou KO */\n" \
17586  "/* */\n" \
17587  "/* Portable : Transparent */\n" \
17588  "/* */\n" \
17589  "/*----------------------------------------------------------------------------*/\n" \
17590  "static int4 giv_ecrit_partie_2_3(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice)\n" \
17591  "{\n" \
17592  " int4 lg_write;\n" \
17593  " char* buf_pos, *buf_pos_ref, *buf_pos_cur;\n" \
17594  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
17595  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
17596  " int4 lg_tp, i, k, kk;\n" \
17597  " int4 iDebut, iCVI;\n" \
17598  " int4 iRang, iObj;\n" \
17599  " int4 iRgLigne, iRgObj;\n" \
17600  " /* Initialisation pointeur */\n" \
17601  " buf_pos = *buf_pos_in;\n" \
17602  " GWTTrace(GWT_NIV_FONCT, (\"Entree partie 2_3 nb MICRO : ... %d\\n\", nb_micro));\n" \
17603  " /* Fin de l'entité inscriptions */\n" \
17604  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"inscriptions\");\n" \
17605  " buf_pos = buf_pos + lg_write;\n" \
17606  " (void)strcpy(givcTriPub, \"1\");\n" \
17607  " iIntRet = giv_ecrit_noeud_objets_pub(&buf_pos, doc, indice, givcTriPub);\n" \
17608  " iIntRet = giv_ecrit_noeud_objets_pvi(&buf_pos, doc, indice);\n" \
17609  " iDebut = 1;\n" \
17610  " /* lecture et ecriture des liens vers les produits à l'epj */\n" \
17611  " iCodRet = givLectureLiensEtab(doc, &buf_pos, &iDebut, indice);\n" \
17612  "\n" \
17613  " if (0 == iDebut)\n" \
17614  " {\n" \
17615  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"elementsproduits\");\n" \
17616  " buf_pos = buf_pos + lg_write;\n" \
17617  " /* Ecriture dans le fichier de sortie */\n" \
17618  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
17619  " }\n" \
17620  "\n" \
17621  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"contenus\");\n" \
17622  " buf_pos = buf_pos + lg_write;\n" \
17623  "\n" \
17624  " for (i = 0; i < indice; i++)\n" \
17625  " {\n" \
17626  " buf_pos_ref = buf_pos;\n" \
17627  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"urls\");\n" \
17628  " buf_pos = buf_pos + lg_write;\n" \
17629  " buf_pos_cur = buf_pos;\n" \
17630  " lg_write = giv_ecrit_balise(buf_pos, (doc + i)->value.inscription[0].moyen_de_com.indrg, \"indrg\");\n" \
17631  " buf_pos = buf_pos + lg_write;\n" \
17632  " lg_write = giv_ecrit_balise(buf_pos, (doc + i)->value.inscription[0].moyen_de_com.numrg, \"numrg\");\n" \
17633  " buf_pos = buf_pos + lg_write;\n" \
17634  " lg_write = giv_ecrit_balise(buf_pos, (doc + i)->value.inscription[0].moyen_de_com.url, \"url\");\n" \
17635  " buf_pos = buf_pos + lg_write;\n" \
17636  "\n" \
17637  " if (0 != strlen((doc + i)->value.inscription[0].moyen_de_com.url))\n" \
17638  " {\n" \
17639  " lg_write = giv_ecrit_balise(buf_pos, \"lvs\", \"typ_url\");\n" \
17640  " buf_pos = buf_pos + lg_write;\n" \
17641  " }\n" \
17642  "\n" \
17643  " if (buf_pos_cur != buf_pos)\n" \
17644  " {\n" \
17645  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"urls\");\n" \
17646  " buf_pos = buf_pos + lg_write;\n" \
17647  " }\n" \
17648  " else\n" \
17649  " {\n" \
17650  " buf_pos = buf_pos_ref;\n" \
17651  " *buf_pos = '\\0';\n" \
17652  " }\n" \
17653  " }\n" \
17654  "\n" \
17655  " /* analyse video d'un PVI */\n" \
17656  " iRang = -1;\n" \
17657  " iRgLigne = -1;\n" \
17658  "\n" \
17659  " for (i = 0; i < givrListObj.iNbr; i++)\n" \
17660  " {\n" \
17661  " k = givrListObj.trEltRangListObj[i];\n" \
17662  " kk = givrListObj.trEltListObj[k].iRgLigne;\n" \
17663  " iObj = givrListObj.trEltListObj[k].iRgObj;\n" \
17664  "\n" \
17665  " if (iRang != givrListObj.trEltListObj[k].iRangTri)\n" \
17666  " {\n" \
17667  " iRang = givrListObj.trEltListObj[k].iRangTri;\n" \
17668  "\n" \
17669  " if (((doc + kk)->value.objets_pub.micro[iObj].type[0] == 'X') && (0 != strlen((doc + kk)->value.objets_pub.micro[iObj].tcdatact))\n" \
17670  " && ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"VI\")) || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"FI\"))\n" \
17671  " || (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"IN\"))))\n" \
17672  " {\n" \
17673  " if (-1 == iRgLigne)\n" \
17674  " {\n" \
17675  " iRgLigne = kk;\n" \
17676  " iRgObj = iObj;\n" \
17677  " }\n" \
17678  " else if (0 < strcmp((doc + kk)->value.objets_pub.micro[iObj].tcdatact, (doc + iRgLigne)->value.objets_pub.micro[iRgObj].tcdatact))\n" \
17679  " {\n" \
17680  " iRgLigne = kk;\n" \
17681  " iRgObj = iObj;\n" \
17682  " }\n" \
17683  " }\n" \
17684  " }\n" \
17685  " }\n" \
17686  "\n" \
17687  " if (-1 != iRgLigne)\n" \
17688  " {\n" \
17689  " lg_write = giv_ecrit_balise(buf_pos, (doc + iRgLigne)->value.objets_pub.micro[iRgObj].tcdatact, \"dmajvideo\");\n" \
17690  " buf_pos = buf_pos + lg_write;\n" \
17691  " }\n" \
17692  "\n" \
17693  " if ('\\0' != GIVBuffXML[0])\n" \
17694  " {\n" \
17695  " /* Ecriture dans le fichier de sortie */\n" \
17696  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
17697  " }\n" \
17698  "\n" \
17699  " iIntRet = giv_ecrit_noeud_objets_url(&buf_pos, doc, indice);\n" \
17700  "\n" \
17701  " if (0 != strlen(doc->value.objets_pub.libUrlSite))\n" \
17702  " {\n" \
17703  " for (i = 1; i < indice; i++)\n" \
17704  " strcpy((doc + i)->value.objets_pub.libUrlSite, doc->value.objets_pub.libUrlSite);\n" \
17705  " }\n" \
17706  "\n" \
17707  " if ('\\0' != GIVBuffXML[0])\n" \
17708  " {\n" \
17709  " /* Ecriture dans le fichier de sortie sans changement de format */\n" \
17710  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
17711  " }\n" \
17712  "\n" \
17713  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"contenus\");\n" \
17714  " buf_pos = buf_pos + lg_write;\n" \
17715  " GWTTrace(GWT_NIV_FONCT, (\"Sortie partie 2_3 nb MICRO : ... %d\\n\", nb_micro));\n" \
17716  "\n" \
17717  " if (0 == strcmp(\"OUI\", givtcContenu))\n" \
17718  " {\n" \
17719  " if (0 == strcmp(givtcRapED, \"ETAB\"))\n" \
17720  " iCodRet = givAnalyseContenu(&buf_pos, doc, indice);\n" \
17721  " else if (0 == strcmp(givtcRapED, \"OUI\"))\n" \
17722  " {\n" \
17723  " /* table des contenus prioritaires inutilisée */\n" \
17724  " giviConflitCRC = GIV::GWCCodeKO;\n" \
17725  " iCVI = GIV::GIXCodeKO;\n" \
17726  " iCodRet = givEcritContenu(\"\", &buf_pos, doc, indice, &iCVI);\n" \
17727  " iCodRet = givEcritContenuED(&buf_pos, doc, indice);\n" \
17728  " }\n" \
17729  "\n" \
17730  " /* enrichissements par le partenaire */\n" \
17731  " iCodRet = givEcritPart(&buf_pos, doc, indice);\n" \
17732  " /* données \"réseaux-relais-colis\" */\n" \
17733  " iCodRet = givEcritDonRelais(&buf_pos, doc, 0, indice);\n" \
17734  " /* données enrichies */\n" \
17735  " iCodRet = givEcritDonEnr(&buf_pos, doc, indice);\n" \
17736  " /* données additionnelles */\n" \
17737  " iCodRet = givEcritDonAdd(\"DA\", &buf_pos, doc, indice);\n" \
17738  " /* mutualisation des données des partenaires */\n" \
17739  " iCodRet = givMutualiserDonPartenaires(&buf_pos, doc, indice);\n" \
17740  " /* données horaires payantes et gratuites */\n" \
17741  " iCodRet = givEcritDonHoraires(&buf_pos, doc, indice);\n" \
17742  " /* lecture et ecriture des Photos de l'epj */\n" \
17743  " iDebut = 1;\n" \
17744  " iCodRet = givLecturePhotosEtab(doc, &buf_pos, &iDebut);\n" \
17745  "\n" \
17746  " if (0 == iDebut)\n" \
17747  " {\n" \
17748  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"affugc\");\n" \
17749  " buf_pos = buf_pos + lg_write;\n" \
17750  " /* Ecriture dans le fichier de sortie */\n" \
17751  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
17752  " }\n" \
17753  "\n" \
17754  " iDebut = 1;\n" \
17755  " /* lecture et ecriture des liens vzers site issus de SEO */\n" \
17756  " iCodRet = givLectureLvsSeoEtab(doc, &buf_pos, &iDebut);\n" \
17757  "\n" \
17758  " if (0 == iDebut)\n" \
17759  " {\n" \
17760  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"lvsparts\");\n" \
17761  " buf_pos = buf_pos + lg_write;\n" \
17762  " /* Ecriture dans le fichier de sortie */\n" \
17763  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
17764  " }\n" \
17765  "\n" \
17766  " /* analyse des CRC (balises <normale>) par epj */\n" \
17767  " iCodRet = givAffCRCEtab(&buf_pos);\n" \
17768  " }\n" \
17769  " else if ('\\0' != GIVBuffXML[0])\n" \
17770  " {\n" \
17771  " /* Ecriture dans le fichier de sortie */\n" \
17772  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
17773  " }\n" \
17774  "\n" \
17775  " *buf_pos_in = buf_pos;\n" \
17776  " return (iCodRet);\n" \
17777  "} /* Fin ecrit partie_2_3 */\n" \
17778  "\n" \
17779  "/*----Fonction----------------------------------------------------------------*/\n" \
17780  "/* */\n" \
17781  "/* Fonction : giv_ecrit_partie_30 () */\n" \
17782  "/* */\n" \
17783  "/* But : ecrit la partie trois spécifique du tri */\n" \
17784  "/* */\n" \
17785  "/* */\n" \
17786  "/* Entree(s) : un buffer, Structure Document */\n" \
17787  "/* */\n" \
17788  "/* Sortie(s) : OK ou KO */\n" \
17789  "/* */\n" \
17790  "/* Portable : Transparent */\n" \
17791  "/* */\n" \
17792  "/*----------------------------------------------------------------------------*/\n" \
17793  "\n" \
17794  "int4 giv_ecrit_partie_30(char** buf_pos_in, int4 iRg, int4 iTri)\n" \
17795  "{\n" \
17796  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
17797  " int4 lg_write;\n" \
17798  " char* buf_pos;\n" \
17799  " int4 pipe; /* Flag pour ajout pipe */\n" \
17800  " int4 i, j, k, l, jj, ll;\n" \
17801  " int4 z, zz;\n" \
17802  " int4 jRef, jRefObj;\n" \
17803  " int4 iNbGeoRub;\n" \
17804  " int4 iAlpha, iPV;\n" \
17805  " int4 iDoc, iObj;\n" \
17806  " char tcElemt[19];\n" \
17807  " char tcStype[3], tcStypcvi[3];\n" \
17808  " /* Initialisation pointeur */\n" \
17809  " buf_pos = *buf_pos_in;\n" \
17810  " j = 0;\n" \
17811  " jRef = -1;\n" \
17812  " jRefObj = -1;\n" \
17813  " iAlpha = -1;\n" \
17814  " l = givrListParu.trEltRangList[j];\n" \
17815  " GWTTrace(GWT_NIV_FONCT, (\"RgTriDbl: %d\\n\", iRg));\n" \
17816  "\n" \
17817  " while (j < givrListParu.iNbr)\n" \
17818  " {\n" \
17819  " if (iRg == givrListParu.trEltList[l].iRgTriDbl)\n" \
17820  " {\n" \
17821  " if (-1 == jRef)\n" \
17822  " {\n" \
17823  " if (GIV::giv_RUB == iTri)\n" \
17824  " {\n" \
17825  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"parutionrubriques\");\n" \
17826  " buf_pos = buf_pos + lg_write;\n" \
17827  " memset(buf_concat, 0, strlen(buf_concat));\n" \
17828  " pipe = 0;\n" \
17829  " }\n" \
17830  " else if (GIV::giv_DNOM == iTri)\n" \
17831  " {\n" \
17832  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"parutiondenoms\");\n" \
17833  " buf_pos = buf_pos + lg_write;\n" \
17834  " }\n" \
17835  " else\n" \
17836  " {\n" \
17837  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"parutionobjets\");\n" \
17838  " buf_pos = buf_pos + lg_write;\n" \
17839  " }\n" \
17840  " }\n" \
17841  "\n" \
17842  " jRef = j;\n" \
17843  "\n" \
17844  " if (GIV::giv_DNOM == iTri)\n" \
17845  " {\n" \
17846  " lg_write = 0;\n" \
17847  "\n" \
17848  " if ((int4)GIV::GIXCodeKO != givrListParu.trEltList[l].iRgLigne)\n" \
17849  " lg_write = giv_ecrit_balise_iso(buf_pos, (doc2 + givrListParu.trEltList[l].iRgLigne)->value.intitule.denomination, \"denom\");\n" \
17850  " }\n" \
17851  " else if (GIV::giv_OBJ == iTri)\n" \
17852  " {\n" \
17853  " iDoc = givrListParu.trEltList[l].iRgLigne;\n" \
17854  " iObj = givrListParu.trEltList[l].iRgObj;\n" \
17855  " giv_ecrit_objet_pub(&buf_pos, doc2, iDoc, iObj, \"objetpub\");\n" \
17856  "\n" \
17857  " if (((0 == strcmp(\"SC\", (doc2 + iDoc)->value.objets_pub.micro[iObj].stype)) && (0 != strcmp(\"PB\", (doc2 + iDoc)->value.objets_pub.micro[iObj].sstype)))\n" \
17858  " || ((0 != strlen((doc2 + iDoc)->value.objets_pub.micro[iObj].stypcvi)) && (0 != strcmp(\"MO\", (doc2 + iDoc)->value.objets_pub.micro[iObj].stype))))\n" \
17859  " {\n" \
17860  " GWTTrace(GWT_NIV_FONCT, (\"iDoc,iObj : %d, %d, %s\\n\", iDoc, iObj, (doc2 + iDoc)->value.objets_pub.micro[iObj].id));\n" \
17861  " pipe = 0;\n" \
17862  " iPV = -1;\n" \
17863  " jRefObj = 0;\n" \
17864  " /* sous-sous-type pour lien PV ou SR */\n" \
17865  " strcpy(tcStype, (doc2 + iDoc)->value.objets_pub.micro[iObj].sstype);\n" \
17866  " strcpy(tcStypcvi, (doc2 + iDoc)->value.objets_pub.micro[iObj].stypcvi);\n" \
17867  "\n" \
17868  " while (jRefObj < givrListParu.iNbrTot)\n" \
17869  " {\n" \
17870  " if (givrListParu.trEltList[l].iRangTri != givrListParu.trEltList[givrListParu.trEltRangList[jRefObj]].iRangTri)\n" \
17871  " {\n" \
17872  " jRefObj++;\n" \
17873  " continue;\n" \
17874  " }\n" \
17875  "\n" \
17876  " jj = 0;\n" \
17877  "\n" \
17878  " while (jj < givrListParu.iNbrTot)\n" \
17879  " {\n" \
17880  " ll = givrListParu.trEltRangList[jj];\n" \
17881  "\n" \
17882  " if (givrListParu.trEltList[ll].iRgLigne == givrListParu.trEltList[givrListParu.trEltRangList[jRefObj]].iRgLigne)\n" \
17883  " {\n" \
17884  " iDoc = givrListParu.trEltList[ll].iRgLigne;\n" \
17885  " iObj = givrListParu.trEltList[ll].iRgObj;\n" \
17886  " GWTTrace(GWT_NIV_FONCT, (\"iDoc,iObj : %d, %d, %s, %s, %s\\n\", iDoc, iObj, (doc2 + iDoc)->value.objets_pub.micro[iObj].stype, (doc2 + iDoc)->value.objets_pub.micro[iObj].sstype,\n" \
17887  " (doc2 + iDoc)->value.objets_pub.micro[iObj].id));\n" \
17888  "\n" \
17889  " if (((0 == strcmp(tcStype, (doc2 + iDoc)->value.objets_pub.micro[iObj].sstype)) && ((0 == strcmp(\"FI\", (doc2 + iDoc)->value.objets_pub.micro[iObj].stype))\n" \
17890  " || (0 == strcmp(\"VI\", (doc2 + iDoc)->value.objets_pub.micro[iObj].stype)) || (0 == strcmp(\"IN\", (doc2 + iDoc)->value.objets_pub.micro[iObj].stype))\n" \
17891  " || (0 == strcmp(\"OB\", (doc2 + iDoc)->value.objets_pub.micro[iObj].stype)) || (0 == strcmp(\"CP\", (doc2 + iDoc)->value.objets_pub.micro[iObj].stype))))\n" \
17892  " || ((0 == strcmp(tcStypcvi, (doc2 + iDoc)->value.objets_pub.micro[iObj].stypcvi)) && (0 == strcmp(\"MO\", (doc2 + iDoc)->value.objets_pub.micro[iObj].stype))))\n" \
17893  " {\n" \
17894  " GWTTrace(GWT_NIV_FONCT, (\"objet lié/pub : %d\\n\", iPV));\n" \
17895  "\n" \
17896  " if (-1 == iPV)\n" \
17897  " {\n" \
17898  " iPV = 0;\n" \
17899  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"objetsLies\");\n" \
17900  " buf_pos = buf_pos + lg_write;\n" \
17901  " }\n" \
17902  "\n" \
17903  " strcpy(tcElemt, (doc2 + iDoc)->value.objets_pub.micro[iObj].stype);\n" \
17904  " strcat(tcElemt, (doc2 + iDoc)->value.objets_pub.micro[iObj].id);\n" \
17905  "\n" \
17906  " if (pipe == 0)\n" \
17907  " {\n" \
17908  " giv_ecrit_objet_pub(&buf_pos, doc2, iDoc, iObj, \"objetpub\");\n" \
17909  " strcpy(buf_concat, tcElemt);\n" \
17910  " pipe = 1;\n" \
17911  " }\n" \
17912  " else if (0 == strstr(buf_concat, tcElemt))\n" \
17913  " {\n" \
17914  " giv_ecrit_objet_pub(&buf_pos, doc2, iDoc, iObj, \"objetpub\");\n" \
17915  " strcat(buf_concat, \"|\");\n" \
17916  " strcat(buf_concat, tcElemt);\n" \
17917  " }\n" \
17918  " }\n" \
17919  " }\n" \
17920  "\n" \
17921  " jj++;\n" \
17922  " }\n" \
17923  "\n" \
17924  " jRefObj++;\n" \
17925  " }\n" \
17926  "\n" \
17927  " if (0 == iPV)\n" \
17928  " {\n" \
17929  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"objetsLies\");\n" \
17930  " buf_pos = buf_pos + lg_write;\n" \
17931  " }\n" \
17932  "\n" \
17933  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"objetpub\");\n" \
17934  " buf_pos = buf_pos + lg_write;\n" \
17935  " }\n" \
17936  "\n" \
17937  " lg_write = 0;\n" \
17938  " }\n" \
17939  " else if (0 != strcmp(givrListParu.trEltList[l].rub, givcR00000000))\n" \
17940  " {\n" \
17941  " /* recherche en priorité d'une rubrique d'origine autre que complémentaire */\n" \
17942  " for (k = 0; (k < givrListParu.trEltList[l].iNbGeoTri && (('4' == givrListParu.trEltList[givrListParu.trEltRangList[j + k]].orig)\n" \
17943  " || ('6' == givrListParu.trEltList[givrListParu.trEltRangList[j + k]].orig) || ('7' == givrListParu.trEltList[givrListParu.trEltRangList[j + k]].orig))); k++)\n" \
17944  " ;\n" \
17945  "\n" \
17946  " if (givrListParu.trEltList[l].iNbGeoTri == k)\n" \
17947  " {\n" \
17948  " if (pipe == 0)\n" \
17949  " {\n" \
17950  " strcpy(buf_concat, givrListParu.trEltList[l].nature);\n" \
17951  " pipe = 1;\n" \
17952  " }\n" \
17953  " else if ((int4)strlen(buf_concat) < ((int4)sizeof(buf_concat) - (int4)strlen(givrListParu.trEltList[l].nature) - (int4)1))\n" \
17954  " {\n" \
17955  " strcat(buf_concat, \"|\");\n" \
17956  " strcat(buf_concat, givrListParu.trEltList[l].nature);\n" \
17957  " }\n" \
17958  " }\n" \
17959  " else\n" \
17960  " {\n" \
17961  " if (pipe == 0)\n" \
17962  " {\n" \
17963  " strcpy(buf_concat, givrListParu.trEltList[l].nature);\n" \
17964  " pipe = 1;\n" \
17965  " }\n" \
17966  " else if ((int4)strlen(buf_concat) < ((int4)sizeof(buf_concat) - (int4)strlen(givrListParu.trEltList[l].nature) - (int4)1))\n" \
17967  " {\n" \
17968  " strcat(buf_concat, \"|\");\n" \
17969  " strcat(buf_concat, givrListParu.trEltList[l].nature);\n" \
17970  " }\n" \
17971  " }\n" \
17972  "\n" \
17973  " lg_write = 0;\n" \
17974  " }\n" \
17975  " else\n" \
17976  " {\n" \
17977  " lg_write = 0;\n" \
17978  " iAlpha = j;\n" \
17979  " }\n" \
17980  "\n" \
17981  " buf_pos = buf_pos + lg_write;\n" \
17982  " }\n" \
17983  "\n" \
17984  " iNbGeoRub = givrListParu.trEltList[l].iNbGeoTri;\n" \
17985  " j = j + iNbGeoRub;\n" \
17986  "\n" \
17987  " if (j < givrListParu.iNbr)\n" \
17988  " l = givrListParu.trEltRangList[j];\n" \
17989  " }\n" \
17990  "\n" \
17991  " if ((GIV::giv_RUB == iTri) && (-1 != jRef))\n" \
17992  " {\n" \
17993  " iIntRet = supprimer_doublon(buf_concat, '|');\n" \
17994  " lg_write = giv_ecrit_balise(buf_pos, buf_concat, \"pjb2b\");\n" \
17995  " buf_pos = buf_pos + lg_write;\n" \
17996  " j = 0;\n" \
17997  " jRef = -1;\n" \
17998  " iAlpha = -1;\n" \
17999  " l = givrListParu.trEltRangList[j];\n" \
18000  " memset(buf_concat, 0, strlen(buf_concat));\n" \
18001  " pipe = 0;\n" \
18002  "\n" \
18003  " while (j < givrListParu.iNbr)\n" \
18004  " {\n" \
18005  " if (iRg == givrListParu.trEltList[l].iRgTriDbl)\n" \
18006  " {\n" \
18007  " jRef = j;\n" \
18008  "\n" \
18009  " if (0 != strcmp(givrListParu.trEltList[l].rub, givcR00000000))\n" \
18010  " {\n" \
18011  " /* recherche de la parution santé */\n" \
18012  " z = givrListParu.trEltList[l].iRgLigne;\n" \
18013  "\n" \
18014  " for (zz = 0; (zz < (doc2 + z)->value.rubriques.iNban9 && (0 != strcmp(givrListParu.trEltList[l].rub, (doc2 + z)->value.rubriques.Tan9[zz].val_codan9))); zz++)\n" \
18015  " ;\n" \
18016  "\n" \
18017  " /* recherche en priorité d'une rubrique d'origine autre que complémentaire */\n" \
18018  " for (k = 0; (k < givrListParu.trEltList[l].iNbGeoTri && (('4' == givrListParu.trEltList[givrListParu.trEltRangList[j + k]].orig)\n" \
18019  " || ('6' == givrListParu.trEltList[givrListParu.trEltRangList[j + k]].orig) || ('7' == givrListParu.trEltList[givrListParu.trEltRangList[j + k]].orig))); k++)\n" \
18020  " ;\n" \
18021  "\n" \
18022  " if (givrListParu.trEltList[l].iNbGeoTri == k)\n" \
18023  " lg_write = giv_ecrit_noeud_rubriques(buf_pos, givrListParu.trEltList[l].rubinit, givrListParu.trEltList[l].rub, givrListParu.trEltList[l].orig, std::string((doc2 + z)->value.rubriques.Tan9[zz].thematique));\n" \
18024  " else\n" \
18025  " lg_write = giv_ecrit_noeud_rubriques(buf_pos, givrListParu.trEltList[l].rubinit, givrListParu.trEltList[l].rub, givrListParu.trEltList[givrListParu.trEltRangList[j + k]].orig, std::string((doc2 + z)->value.rubriques.Tan9[zz].thematique));\n" \
18026  " }\n" \
18027  " else\n" \
18028  " {\n" \
18029  " lg_write = 0;\n" \
18030  " iAlpha = j;\n" \
18031  " }\n" \
18032  "\n" \
18033  " buf_pos = buf_pos + lg_write;\n" \
18034  " }\n" \
18035  "\n" \
18036  " iNbGeoRub = givrListParu.trEltList[l].iNbGeoTri;\n" \
18037  " j = j + iNbGeoRub;\n" \
18038  "\n" \
18039  " if (j < givrListParu.iNbr)\n" \
18040  " l = givrListParu.trEltRangList[j];\n" \
18041  " }\n" \
18042  " }\n" \
18043  "\n" \
18044  " j = jRef;\n" \
18045  "\n" \
18046  " if (-1 != iAlpha)\n" \
18047  " {\n" \
18048  " lg_write = giv_ecrit_balise(buf_pos, \"O\", \"alpha\");\n" \
18049  " buf_pos = buf_pos + lg_write;\n" \
18050  " }\n" \
18051  "\n" \
18052  " *buf_pos_in = buf_pos;\n" \
18053  " return (j);\n" \
18054  "} /* Fin ecrit partie_30 */\n" \
18055  "\n" \
18056  "/*----Fonction----------------------------------------------------------------*/\n" \
18057  "/* */\n" \
18058  "/* Fonction : giv_ecrit_partie_3_geo () */\n" \
18059  "/* */\n" \
18060  "/* But : ecrit la partie trois par géographie selon le tri */\n" \
18061  "/* */\n" \
18062  "/* */\n" \
18063  "/* Entree(s) : un buffer, Structure Document */\n" \
18064  "/* */\n" \
18065  "/* Sortie(s) : OK ou KO */\n" \
18066  "/* */\n" \
18067  "/* Portable : Transparent */\n" \
18068  "/* */\n" \
18069  "/*----------------------------------------------------------------------------*/\n" \
18070  "\n" \
18071  "int4 giv_ecrit_partie_3_geo(char** buf_pos_in, GYBrDOCUMENTEpj* docClone, int4 iInit, int4 iRangTri, int4 iTypeLoc, int4 iValLoc, char* pcBalise)\n" \
18072  "{\n" \
18073  " int4 lg; /* Logueur du champ à traiter */\n" \
18074  " int4 lg_write;\n" \
18075  " char* buf_pos;\n" \
18076  " int4 iCodRet, iIntRet; /* Code retour de la fonction */\n" \
18077  " int4 pipe; /* Flag pour ajout pipe */\n" \
18078  " int4 i, j, k, l, q, jj, ll;\n" \
18079  " int4 iRang, iRgLigne, iObj;\n" \
18080  " char tcRang[4 + 1];\n" \
18081  " char tcDeplocarr[GYBIeinscLgDeppar + GYBIeinscLgLocpar + GYBIeinscLgArrond + 1];\n" \
18082  " char tcBalises[50 + 1];\n" \
18083  " int4 iGeo, iParuInst;\n" \
18084  " char* pt_fin_lst;\n" \
18085  " char* pt_debut;\n" \
18086  " char* pt_fin;\n" \
18087  " iCodRet = GIV::GWCCodeOK;\n" \
18088  " /* Initialisation pointeur */\n" \
18089  " buf_pos = *buf_pos_in;\n" \
18090  " /* balise encadrante */\n" \
18091  " strcpy(tcBalises, pcBalise);\n" \
18092  " memset(buf_concat, 0, strlen(buf_concat));\n" \
18093  " pipe = 0;\n" \
18094  " j = iInit;\n" \
18095  "\n" \
18096  " while (j < givrListParu.iNbrTot)\n" \
18097  " {\n" \
18098  " if ((iRangTri != givrListParu.trEltList[givrListParu.trEltRangList[j]].iRangTri) && (GIV::giv_ARR == iValLoc))\n" \
18099  " {\n" \
18100  " j++;\n" \
18101  " continue;\n" \
18102  " }\n" \
18103  " else if (iRangTri != givrListParu.trEltList[givrListParu.trEltRangList[j]].iRangTri)\n" \
18104  " {\n" \
18105  " j++;\n" \
18106  " continue;\n" \
18107  " }\n" \
18108  "\n" \
18109  " l = givrListParu.trEltRangList[j];\n" \
18110  "\n" \
18111  " if (GIV::giv_ARR == iTypeLoc)\n" \
18112  " iGeo = givrListParu.trEltList[l].iGeoArr;\n" \
18113  " else if (GIV::giv_LOC == iTypeLoc)\n" \
18114  " iGeo = givrListParu.trEltList[l].iGeoLoc;\n" \
18115  " else if (GIV::giv_DEPT == iTypeLoc)\n" \
18116  " iGeo = givrListParu.trEltList[l].iGeoDept;\n" \
18117  " else if (GIV::giv_REG == iTypeLoc)\n" \
18118  " iGeo = givrListParu.trEltList[l].iGeoReg;\n" \
18119  "\n" \
18120  " iParuInst = (int4)GIV::GIXCodeOK;\n" \
18121  " iRgLigne = givrListParu.trEltList[l].iRgLigne;\n" \
18122  "\n" \
18123  " for (q = 0; (q < 3 && GIV::giv_ARR == iValLoc && iValLoc == iGeo && 0 != strcmp(\"0000\", (docClone + iRgLigne)->value.inscription[0].val_ls)); q++)\n" \
18124  " {\n" \
18125  " /* parution sur arrondissement d'installation */\n" \
18126  " if ((0 == strcmp(givtrRefArr[q].dep, givrListParu.trEltList[l].dep)) && (0 == strcmp(givtrRefArr[q].loc, givrListParu.trEltList[l].loc)))\n" \
18127  " {\n" \
18128  " iParuInst = givtrRefArr[q].iParuInst;\n" \
18129  " break;\n" \
18130  " }\n" \
18131  " }\n" \
18132  "\n" \
18133  " if (GIV::giv_ZU == iValLoc)\n" \
18134  " GWTTrace(GWT_NIV_FONCT, (\"ZU Ins : %d, %d, %s, %s\\n\", iGeo, givrListParu.trEltList[l].iZU, givrListParu.trEltList[l].dep, givrListParu.trEltList[l].loc));\n" \
18135  "\n" \
18136  " if ((0 == strcmp(\"999\", givrListParu.trEltList[l].dep)) && (GIV::giv_REG != iTypeLoc))\n" \
18137  " {\n" \
18138  " /* ancienne région : seule la parution sur région est validée */\n" \
18139  " }\n" \
18140  " else if (((GIV::giv_ARR == iValLoc) && ((int4)GIV::GIXCodeOK != iParuInst)) || ((GIV::giv_ARR != iValLoc) && (GIV::giv_ZU != iValLoc) && (GIV::giv_ZV != iValLoc) && (GIV::giv_UV != iValLoc)\n" \
18141  " && (iValLoc == iGeo)) || ((GIV::giv_ZU == iValLoc) && (GIV::giv_DEPT == iGeo) && ((int4)GIV::GIXCodeOK == givrListParu.trEltList[l].iZU)) || ((GIV::giv_ZU == iValLoc) && (GIV::giv_EXTL == iGeo)\n" \
18142  " && ((int4)GIV::GIXCodeOK == givrListParu.trEltList[l].iZU)) || ((GIV::giv_ZV == iValLoc) && (iTypeLoc == iGeo)) || ((GIV::giv_UV == iValLoc) && ('1' == givrListParu.trEltList[l].cParuloc)\n" \
18143  " && (GIV::giv_ARR != iTypeLoc)) || ((GIV::giv_UV == iValLoc) && ('1' == givrListParu.trEltList[l].cParuloc) && (GIV::giv_ARR == iTypeLoc) && (0 != strcmp(\"99\", givrListParu.trEltList[l].arr))\n" \
18144  " && (0 != strcmp(\"00\", givrListParu.trEltList[l].arr)) && (GIV::giv_INIT_ARR != iGeo)))\n" \
18145  " {\n" \
18146  " if (pipe == 0)\n" \
18147  " {\n" \
18148  " if (0 == strcmp(\"pjdeploc\", pcBalise))\n" \
18149  " {\n" \
18150  " lg_write = giv_ecrit_element(buf_pos, \"pjlocal\", \"1\");\n" \
18151  " buf_pos = buf_pos + lg_write;\n" \
18152  " }\n" \
18153  " }\n" \
18154  "\n" \
18155  " if (GIV::giv_ZV == iValLoc)\n" \
18156  " {\n" \
18157  " jj = iInit;\n" \
18158  "\n" \
18159  " while (jj < givrListParu.iNbrTot)\n" \
18160  " {\n" \
18161  " if (iRangTri != givrListParu.trEltList[givrListParu.trEltRangList[jj]].iRangTri)\n" \
18162  " {\n" \
18163  " jj++;\n" \
18164  " continue;\n" \
18165  " }\n" \
18166  "\n" \
18167  " ll = givrListParu.trEltRangList[jj];\n" \
18168  "\n" \
18169  " if (((int4)GIV::GIXCodeOK == givrListParu.trEltList[ll].iZU) && (0 != strcmp(\"999\", givrListParu.trEltList[ll].dep)) && (givrListParu.trEltList[l].iRgLigne == givrListParu.trEltList[ll].iRgLigne))\n" \
18170  " {\n" \
18171  " strcpy(tcDeplocarr, givrListParu.trEltList[ll].dep);\n" \
18172  " strcat(tcDeplocarr, givrListParu.trEltList[ll].loc);\n" \
18173  "\n" \
18174  " if (sizeof(buf_concat) < (strlen(buf_concat) + strlen(tcDeplocarr)))\n" \
18175  " {\n" \
18176  " /* Trop d'entrées internes */\n" \
18177  " GWTTrace(GWT_NIV_GRAVE, (\"Taille buffer interne dépassée\\n\"));\n" \
18178  " break;\n" \
18179  " }\n" \
18180  "\n" \
18181  " if (pipe == 0)\n" \
18182  " {\n" \
18183  " strcpy(buf_concat, tcDeplocarr);\n" \
18184  " pipe = 1;\n" \
18185  " }\n" \
18186  " else if (0 == strstr(buf_concat, tcDeplocarr))\n" \
18187  " {\n" \
18188  " strcat(buf_concat, \"|\");\n" \
18189  " strcat(buf_concat, tcDeplocarr);\n" \
18190  " }\n" \
18191  " }\n" \
18192  "\n" \
18193  " jj++;\n" \
18194  " }\n" \
18195  "\n" \
18196  " j++;\n" \
18197  " continue;\n" \
18198  " }\n" \
18199  " else if (GIV::giv_UV == iValLoc)\n" \
18200  " {\n" \
18201  " if (0 == strcmp(givrListParu.trEltList[l].loc, givcLocFictive))\n" \
18202  " {\n" \
18203  " /* ajout de toutes les localités du département pour LF */\n" \
18204  " iIntRet = givLectureLocDep(givrListParu.trEltList[l].dep, &pipe);\n" \
18205  " j++;\n" \
18206  " continue;\n" \
18207  " }\n" \
18208  " else if (GIV::giv_ARR == iTypeLoc)\n" \
18209  " {\n" \
18210  " strcpy(tcDeplocarr, givrListParu.trEltList[l].dep);\n" \
18211  " strcat(tcDeplocarr, givrListParu.trEltList[l].loc);\n" \
18212  " strcat(tcDeplocarr, givrListParu.trEltList[l].arr);\n" \
18213  " }\n" \
18214  " else\n" \
18215  " {\n" \
18216  " strcpy(tcDeplocarr, givrListParu.trEltList[l].dep);\n" \
18217  " strcat(tcDeplocarr, givrListParu.trEltList[l].loc);\n" \
18218  " }\n" \
18219  " }\n" \
18220  " else if (GIV::giv_ARR == iTypeLoc)\n" \
18221  " {\n" \
18222  " strcpy(tcDeplocarr, givrListParu.trEltList[l].dep);\n" \
18223  " strcat(tcDeplocarr, givrListParu.trEltList[l].loc);\n" \
18224  " strcat(tcDeplocarr, givrListParu.trEltList[l].arr);\n" \
18225  " }\n" \
18226  " else if (GIV::giv_LOC == iTypeLoc)\n" \
18227  " {\n" \
18228  " strcpy(tcDeplocarr, givrListParu.trEltList[l].dep);\n" \
18229  " strcat(tcDeplocarr, givrListParu.trEltList[l].loc);\n" \
18230  " }\n" \
18231  " else if (GIV::giv_DEPT == iTypeLoc)\n" \
18232  " strcpy(tcDeplocarr, givrListParu.trEltList[l].dep);\n" \
18233  " else if (GIV::giv_REG == iTypeLoc)\n" \
18234  " strcpy(tcDeplocarr, givrListParu.trEltList[l].reg);\n" \
18235  "\n" \
18236  " if (sizeof(buf_concat) < (strlen(buf_concat) + strlen(tcDeplocarr)))\n" \
18237  " {\n" \
18238  " /* Trop d'entrées internes */\n" \
18239  " GWTTrace(GWT_NIV_GRAVE, (\"Taille buffer interne dépassée\\n\"));\n" \
18240  " break;\n" \
18241  " }\n" \
18242  "\n" \
18243  " if (pipe == 0)\n" \
18244  " {\n" \
18245  " strcpy(buf_concat, tcDeplocarr);\n" \
18246  " pipe = 1;\n" \
18247  " }\n" \
18248  " else if (0 == strstr(buf_concat, tcDeplocarr))\n" \
18249  " {\n" \
18250  " strcat(buf_concat, \"|\");\n" \
18251  " strcat(buf_concat, tcDeplocarr);\n" \
18252  " }\n" \
18253  " }\n" \
18254  "\n" \
18255  " j++;\n" \
18256  " }\n" \
18257  "\n" \
18258  " j = iInit;\n" \
18259  "\n" \
18260  " while ((j < givrListInst.iNbrTot) && (GIV::giv_ARR == iTypeLoc) && (GIV::giv_ARR == iValLoc))\n" \
18261  " {\n" \
18262  " if (iRangTri != givrListInst.trEltList[givrListInst.trEltRangList[j]].iRangTri)\n" \
18263  " {\n" \
18264  " j++;\n" \
18265  " continue;\n" \
18266  " }\n" \
18267  "\n" \
18268  " l = givrListInst.trEltRangList[j];\n" \
18269  " iGeo = givrListInst.trEltList[l].iGeoArr;\n" \
18270  " iRgLigne = givrListInst.trEltList[l].iRgLigne;\n" \
18271  "\n" \
18272  " for (q = 0; q < 3; q++)\n" \
18273  " {\n" \
18274  " /* parution sur arrondissement d'installation */\n" \
18275  " if ((0 == strcmp(givtrRefArr[q].dep, givrListInst.trEltList[l].dep)) && (0 == strcmp(givtrRefArr[q].loc, givrListInst.trEltList[l].loc)))\n" \
18276  " {\n" \
18277  " iParuInst = givtrRefArr[q].iParuInst;\n" \
18278  " break;\n" \
18279  " }\n" \
18280  " }\n" \
18281  "\n" \
18282  " if (0 == strcmp(\"0000\", (docClone + iRgLigne)->value.inscription[0].val_ls))\n" \
18283  " iParuInst = (int4)GIV::GIXCodeOK;\n" \
18284  "\n" \
18285  " if (((int4)GIV::GIXCodeOK == iParuInst) && (iValLoc == iGeo))\n" \
18286  " {\n" \
18287  " if (pipe == 0)\n" \
18288  " {\n" \
18289  " if (0 == strcmp(\"pjdeploc\", pcBalise))\n" \
18290  " {\n" \
18291  " lg_write = giv_ecrit_element(buf_pos, \"pjlocal\", \"1\");\n" \
18292  " buf_pos = buf_pos + lg_write;\n" \
18293  " }\n" \
18294  " }\n" \
18295  "\n" \
18296  " strcpy(tcDeplocarr, givrListInst.trEltList[l].dep);\n" \
18297  " strcat(tcDeplocarr, givrListInst.trEltList[l].loc);\n" \
18298  " strcat(tcDeplocarr, givrListInst.trEltList[l].arr);\n" \
18299  "\n" \
18300  " if (sizeof(buf_concat) < (strlen(buf_concat) + strlen(tcDeplocarr)))\n" \
18301  " {\n" \
18302  " /* Trop d'entrées internes */\n" \
18303  " GWTTrace(GWT_NIV_GRAVE, (\"Taille buffer interne dépassée\\n\"));\n" \
18304  " break;\n" \
18305  " }\n" \
18306  "\n" \
18307  " if (pipe == 0)\n" \
18308  " {\n" \
18309  " strcpy(buf_concat, tcDeplocarr);\n" \
18310  " pipe = 1;\n" \
18311  " }\n" \
18312  " else if (0 == strstr(buf_concat, tcDeplocarr))\n" \
18313  " {\n" \
18314  " strcat(buf_concat, \"|\");\n" \
18315  " strcat(buf_concat, tcDeplocarr);\n" \
18316  " }\n" \
18317  " }\n" \
18318  "\n" \
18319  " j++;\n" \
18320  " }\n" \
18321  "\n" \
18322  " if (GIV::giv_ZU == iValLoc)\n" \
18323  " GWTTrace(GWT_NIV_FONCT, (\"ZU Ins Buf: %s\\n\", buf_concat));\n" \
18324  "\n" \
18325  " if (1 == pipe)\n" \
18326  " {\n" \
18327  " iIntRet = supprimer_doublon(buf_concat, '|');\n" \
18328  " GWTTrace(GWT_NIV_FONCT, (\"Taille liste geo : '%d'\\n\", strlen(buf_concat)));\n" \
18329  " pt_fin_lst = buf_concat + strlen(buf_concat);\n" \
18330  "\n" \
18331  " for (pt_debut = buf_concat; pt_debut < pt_fin_lst;)\n" \
18332  " {\n" \
18333  " pt_fin = strchr(pt_debut, '|');\n" \
18334  "\n" \
18335  " if (pt_fin == 0)\n" \
18336  " pt_fin = pt_fin_lst;\n" \
18337  "\n" \
18338  " /* analyse geo */\n" \
18339  " memcpy(tcDeplocarr, pt_debut, (pt_fin - pt_debut));\n" \
18340  " tcDeplocarr[(pt_fin - pt_debut)] = '\\0';\n" \
18341  " lg_write = giv_ecrit_element(buf_pos, pcBalise, tcDeplocarr);\n" \
18342  " buf_pos = buf_pos + lg_write;\n" \
18343  " pt_debut = pt_fin + 1;\n" \
18344  " }\n" \
18345  " }\n" \
18346  " else\n" \
18347  " iCodRet = GIV::GWCCodeKO;\n" \
18348  "\n" \
18349  " *buf_pos_in = buf_pos;\n" \
18350  " return (iCodRet);\n" \
18351  "} /* Fin ecrit partie_3_geo */\n" \
18352  "\n" \
18353  "/*----Fonction----------------------------------------------------------------*/\n" \
18354  "/* */\n" \
18355  "/* Fonction : giv_ecrit_partie_3_an9 () */\n" \
18356  "/* */\n" \
18357  "/* But : ecrit la partie trois du tri rubrique */\n" \
18358  "/* */\n" \
18359  "/* */\n" \
18360  "/* Entree(s) : un buffer, Structure Document */\n" \
18361  "/* */\n" \
18362  "/* Sortie(s) : OK ou KO */\n" \
18363  "/* */\n" \
18364  "/* Portable : Transparent */\n" \
18365  "/* */\n" \
18366  "/*----------------------------------------------------------------------------*/\n" \
18367  "\n" \
18368  "int4 giv_ecrit_partie_3_an9(char** buf_pos_in, GYBrDOCUMENTEpj* docClone, int4 iRangTri, int4 iTypeLoc, int4 iValLoc, char* pcBalise)\n" \
18369  "{\n" \
18370  " int4 lg; /* Logueur du champ à traiter */\n" \
18371  " int4 lg_write;\n" \
18372  " char* buf_pos;\n" \
18373  " int4 iCodRet, iIntRet; /* Code retour de la fonction */\n" \
18374  " int4 pipe; /* Flag pour ajout pipe */\n" \
18375  " int4 i, j, k, l, q, jj, ll;\n" \
18376  " int4 iRang, iRgLigne, iObj;\n" \
18377  " char tcRang[4 + 1];\n" \
18378  " char tcDeploc[GYBIeinscLgDeppar + GYBIeinscLgLocpar + 1];\n" \
18379  " int4 iGeo, iParuInst;\n" \
18380  " char* pt_fin_lst;\n" \
18381  " char* pt_debut;\n" \
18382  " char* pt_fin;\n" \
18383  " char tcBalise[50 + 1];\n" \
18384  " iCodRet = GIV::GWCCodeOK;\n" \
18385  " /* Initialisation pointeur */\n" \
18386  " buf_pos = *buf_pos_in;\n" \
18387  " buf_concat[0] = '\\0';\n" \
18388  " pipe = 0;\n" \
18389  "\n" \
18390  " for (j = 0; j < givrListParu.iNbrTot; j++)\n" \
18391  " {\n" \
18392  " l = givrListParu.trEltRangList[j];\n" \
18393  "\n" \
18394  " if (iRangTri == givrListParu.trEltList[l].iRgTriDbl)\n" \
18395  " {\n" \
18396  " if (GIV::giv_ARR == iTypeLoc)\n" \
18397  " iGeo = givrListParu.trEltList[l].iGeoArr;\n" \
18398  " else if (GIV::giv_LOC == iTypeLoc)\n" \
18399  " iGeo = givrListParu.trEltList[l].iGeoLoc;\n" \
18400  " else if (GIV::giv_DEPT == iTypeLoc)\n" \
18401  " iGeo = givrListParu.trEltList[l].iGeoDept;\n" \
18402  " else if (GIV::giv_REG == iTypeLoc)\n" \
18403  " iGeo = givrListParu.trEltList[l].iGeoReg;\n" \
18404  "\n" \
18405  " iParuInst = (int4)GIV::GIXCodeOK;\n" \
18406  " iRgLigne = givrListParu.trEltList[l].iRgLigne;\n" \
18407  "\n" \
18408  " for (q = 0; (q < 3 && GIV::giv_ARR == iValLoc && iValLoc == iGeo && 0 != strcmp(\"0000\", (docClone + iRgLigne)->value.inscription[0].val_ls)); q++)\n" \
18409  " {\n" \
18410  " /* parution sur arrondissement d'installation */\n" \
18411  " if ((0 == strcmp(givtrRefArr[q].dep, givrListParu.trEltList[l].dep)) && (0 == strcmp(givtrRefArr[q].loc, givrListParu.trEltList[l].loc)))\n" \
18412  " {\n" \
18413  " iParuInst = givtrRefArr[q].iParuInst;\n" \
18414  " break;\n" \
18415  " }\n" \
18416  " }\n" \
18417  "\n" \
18418  " if ((0 == strcmp(\"999\", givrListParu.trEltList[l].dep)) && (GIV::giv_REG != iTypeLoc))\n" \
18419  " {\n" \
18420  " /* ancienne région : seule la parution sur région est validée */\n" \
18421  " }\n" \
18422  " else if ((GIV::giv_ZV == iValLoc) && (iTypeLoc == iGeo))\n" \
18423  " {\n" \
18424  " jj = 0;\n" \
18425  "\n" \
18426  " while (jj < givrListParu.iNbrTot)\n" \
18427  " {\n" \
18428  " if (iRangTri != givrListParu.trEltList[givrListParu.trEltRangList[jj]].iRangTri)\n" \
18429  " {\n" \
18430  " jj++;\n" \
18431  " continue;\n" \
18432  " }\n" \
18433  "\n" \
18434  " ll = givrListParu.trEltRangList[jj];\n" \
18435  "\n" \
18436  " if (((int4)GIV::GIXCodeOK == givrListParu.trEltList[ll].iZU) && (0 != strcmp(\"999\", givrListParu.trEltList[ll].dep)) && (givrListParu.trEltList[l].iRgLigne == givrListParu.trEltList[ll].iRgLigne))\n" \
18437  " {\n" \
18438  " i = givrListParu.trEltList[ll].iRgLigne;\n" \
18439  "\n" \
18440  " if ((int4)10000 < (strlen(buf_concat) + strlen(givrListParu.trEltList[ll].tcRgDnom)))\n" \
18441  " {\n" \
18442  " /* Trop d'entrées internes */\n" \
18443  " GWTTrace(GWT_NIV_GRAVE, (\"Taille buffer interne dépassée\\n\"));\n" \
18444  " break;\n" \
18445  " }\n" \
18446  "\n" \
18447  " if (pipe == 0)\n" \
18448  " {\n" \
18449  " strcpy(buf_concat, givrListParu.trEltList[ll].tcRgDnom);\n" \
18450  " buf_concat[10000] = '\\0';\n" \
18451  " pipe = 1;\n" \
18452  " }\n" \
18453  " else if (0 == strstr(buf_concat, givrListParu.trEltList[ll].tcRgDnom))\n" \
18454  " {\n" \
18455  " strcat(buf_concat, \"|\");\n" \
18456  " strcat(buf_concat, givrListParu.trEltList[ll].tcRgDnom);\n" \
18457  " }\n" \
18458  "\n" \
18459  " /* Analyse des objets */\n" \
18460  " for (q = 0; q < givrListObj.iNbr; q++)\n" \
18461  " {\n" \
18462  " if (i == givrListObj.trEltListObj[givrListObj.trEltRangListObj[q]].iRgLigne)\n" \
18463  " {\n" \
18464  " k = givrListObj.trEltListObj[givrListObj.trEltRangListObj[q]].iRgObj;\n" \
18465  "\n" \
18466  " if ((int4)40000 < (strlen(&buf_concat[10000]) + strlen((docClone + i)->value.objets_pub.micro[k].tcRgObj)))\n" \
18467  " {\n" \
18468  " /* Trop d'entrées internes */\n" \
18469  " GWTTrace(GWT_NIV_GRAVE, (\"Taille buffer interne dépassée\\n\"));\n" \
18470  " break;\n" \
18471  " }\n" \
18472  "\n" \
18473  " if ('\\0' == buf_concat[10000])\n" \
18474  " strcpy(&buf_concat[10000], (docClone + i)->value.objets_pub.micro[k].tcRgObj);\n" \
18475  " else if (0 == strstr(&buf_concat[10000], (docClone + i)->value.objets_pub.micro[k].tcRgObj))\n" \
18476  " {\n" \
18477  " strcat(&buf_concat[10000], \"|\");\n" \
18478  " strcat(&buf_concat[10000], (docClone + i)->value.objets_pub.micro[k].tcRgObj);\n" \
18479  " }\n" \
18480  " }\n" \
18481  " }\n" \
18482  " }\n" \
18483  "\n" \
18484  " jj++;\n" \
18485  " }\n" \
18486  " }\n" \
18487  " else if (((GIV::giv_ARR == iValLoc) && ((int4)GIV::GIXCodeOK != iParuInst)) || ((GIV::giv_ARR != iValLoc) && (GIV::giv_ZU != iValLoc) && (GIV::giv_UV != iValLoc) && (iValLoc == iGeo))\n" \
18488  " || ((GIV::giv_ZU == iValLoc) && (GIV::giv_DEPT == iGeo) && ((int4)GIV::GIXCodeOK == givrListParu.trEltList[l].iZU)) || ((GIV::giv_ZU == iValLoc) && (GIV::giv_EXTL == iGeo)\n" \
18489  " && ((int4)GIV::GIXCodeOK == givrListParu.trEltList[l].iZU)) || ((GIV::giv_UV == iValLoc) && ('1' == givrListParu.trEltList[l].cParuloc) && (GIV::giv_DFT != iGeo) && (GIV::giv_INIT_ARR != iGeo)))\n" \
18490  " {\n" \
18491  " i = givrListParu.trEltList[l].iRgLigne;\n" \
18492  "\n" \
18493  " if ((int4)10000 < (strlen(buf_concat) + strlen(givrListParu.trEltList[l].tcRgDnom)))\n" \
18494  " {\n" \
18495  " /* Trop d'entrées internes */\n" \
18496  " GWTTrace(GWT_NIV_GRAVE, (\"Taille buffer interne dépassée\\n\"));\n" \
18497  " break;\n" \
18498  " }\n" \
18499  "\n" \
18500  " if (pipe == 0)\n" \
18501  " {\n" \
18502  " strcpy(buf_concat, givrListParu.trEltList[l].tcRgDnom);\n" \
18503  " buf_concat[10000] = '\\0';\n" \
18504  " pipe = 1;\n" \
18505  " }\n" \
18506  " else if (0 == strstr(buf_concat, givrListParu.trEltList[l].tcRgDnom))\n" \
18507  " {\n" \
18508  " strcat(buf_concat, \"|\");\n" \
18509  " strcat(buf_concat, givrListParu.trEltList[l].tcRgDnom);\n" \
18510  " }\n" \
18511  "\n" \
18512  " for (q = 0; q < givrListObj.iNbr; q++)\n" \
18513  " {\n" \
18514  " if (i == givrListObj.trEltListObj[givrListObj.trEltRangListObj[q]].iRgLigne)\n" \
18515  " {\n" \
18516  " k = givrListObj.trEltListObj[givrListObj.trEltRangListObj[q]].iRgObj;\n" \
18517  "\n" \
18518  " if ((int4)40000 < (strlen(&buf_concat[10000]) + strlen((docClone + i)->value.objets_pub.micro[k].tcRgObj)))\n" \
18519  " {\n" \
18520  " /* Trop d'entrées internes */\n" \
18521  " GWTTrace(GWT_NIV_GRAVE, (\"Taille buffer interne dépassée\\n\"));\n" \
18522  " break;\n" \
18523  " }\n" \
18524  "\n" \
18525  " if ('\\0' == buf_concat[10000])\n" \
18526  " strcpy(&buf_concat[10000], (docClone + i)->value.objets_pub.micro[k].tcRgObj);\n" \
18527  " else if (0 == strstr(&buf_concat[10000], (docClone + i)->value.objets_pub.micro[k].tcRgObj))\n" \
18528  " {\n" \
18529  " strcat(&buf_concat[10000], \"|\");\n" \
18530  " strcat(&buf_concat[10000], (docClone + i)->value.objets_pub.micro[k].tcRgObj);\n" \
18531  " }\n" \
18532  " }\n" \
18533  " }\n" \
18534  " }\n" \
18535  " }\n" \
18536  "\n" \
18537  " GWTTrace(GWT_NIV_FONCT, (\"Ref Pub geo pour An9 : ... %d,%d,%d,%d,%s,%s\\n\", iRangTri, givrListParu.trEltList[l].iRgTriDbl, givrListParu.trEltList[l].iRangTri, givrListParu.trEltList[l].iRgLigne,\n" \
18538  " buf_concat, &buf_concat[10000]));\n" \
18539  " }\n" \
18540  "\n" \
18541  " GWTTrace(GWT_NIV_FONCT, (\"Ref Pub geo pour An9 : ... %s,%s\\n\", buf_concat, &buf_concat[10000]));\n" \
18542  "\n" \
18543  " for (j = 0; (j < givrListInst.iNbrTot && GIV::giv_ARR == iTypeLoc && GIV::giv_ARR == iValLoc); j++)\n" \
18544  " {\n" \
18545  " l = givrListInst.trEltRangList[j];\n" \
18546  " iGeo = givrListInst.trEltList[l].iGeoArr;\n" \
18547  "\n" \
18548  " if ((iRangTri == givrListInst.trEltList[l].iRgTriDbl) && (iValLoc == iGeo))\n" \
18549  " {\n" \
18550  " iRgLigne = givrListInst.trEltList[l].iRgLigne;\n" \
18551  "\n" \
18552  " for (q = 0; q < 3; q++)\n" \
18553  " {\n" \
18554  " /* parution sur arrondissement d'installation */\n" \
18555  " if ((0 == strcmp(givtrRefArr[q].dep, givrListInst.trEltList[l].dep)) && (0 == strcmp(givtrRefArr[q].loc, givrListInst.trEltList[l].loc)))\n" \
18556  " {\n" \
18557  " iParuInst = givtrRefArr[q].iParuInst;\n" \
18558  " break;\n" \
18559  " }\n" \
18560  " }\n" \
18561  "\n" \
18562  " if (0 == strcmp(\"0000\", (docClone + iRgLigne)->value.inscription[0].val_ls))\n" \
18563  " iParuInst = (int4)GIV::GIXCodeOK;\n" \
18564  "\n" \
18565  " if ((int4)GIV::GIXCodeOK == iParuInst)\n" \
18566  " {\n" \
18567  " i = givrListInst.trEltList[l].iRgLigne;\n" \
18568  "\n" \
18569  " if ((int4)10000 < (strlen(buf_concat) + strlen(givrListParu.trEltList[l].tcRgDnom)))\n" \
18570  " {\n" \
18571  " /* Trop d'entrées internes */\n" \
18572  " GWTTrace(GWT_NIV_GRAVE, (\"Taille buffer interne dépassée\\n\"));\n" \
18573  " break;\n" \
18574  " }\n" \
18575  "\n" \
18576  " if (pipe == 0)\n" \
18577  " {\n" \
18578  " strcpy(buf_concat, givrListInst.trEltList[l].tcRgDnom);\n" \
18579  " buf_concat[10000] = '\\0';\n" \
18580  " pipe = 1;\n" \
18581  " }\n" \
18582  " else if (0 == strstr(buf_concat, givrListInst.trEltList[l].tcRgDnom))\n" \
18583  " {\n" \
18584  " strcat(buf_concat, \"|\");\n" \
18585  " strcat(buf_concat, givrListInst.trEltList[l].tcRgDnom);\n" \
18586  " }\n" \
18587  "\n" \
18588  " for (q = 0; q < givrListObj.iNbr; q++)\n" \
18589  " {\n" \
18590  " if (i == givrListObj.trEltListObj[givrListObj.trEltRangListObj[q]].iRgLigne)\n" \
18591  " {\n" \
18592  " k = givrListObj.trEltListObj[givrListObj.trEltRangListObj[q]].iRgObj;\n" \
18593  "\n" \
18594  " if ((int4)40000 < (strlen(&buf_concat[10000]) + strlen((docClone + i)->value.objets_pub.micro[k].tcRgObj)))\n" \
18595  " {\n" \
18596  " /* Trop d'entrées internes */\n" \
18597  " GWTTrace(GWT_NIV_GRAVE, (\"Taille buffer interne dépassée\\n\"));\n" \
18598  " break;\n" \
18599  " }\n" \
18600  "\n" \
18601  " if ('\\0' == buf_concat[10000])\n" \
18602  " strcpy(&buf_concat[10000], (docClone + i)->value.objets_pub.micro[k].tcRgObj);\n" \
18603  " else if (0 == strstr(&buf_concat[10000], (docClone + i)->value.objets_pub.micro[k].tcRgObj))\n" \
18604  " {\n" \
18605  " strcat(&buf_concat[10000], \"|\");\n" \
18606  " strcat(&buf_concat[10000], (docClone + i)->value.objets_pub.micro[k].tcRgObj);\n" \
18607  " }\n" \
18608  " }\n" \
18609  " }\n" \
18610  " }\n" \
18611  " }\n" \
18612  " }\n" \
18613  "\n" \
18614  " if (1 == pipe)\n" \
18615  " {\n" \
18616  " iIntRet = supprimer_doublon(buf_concat, '|');\n" \
18617  " strcpy(tcBalise, \"pjdenom\");\n" \
18618  " strcat(tcBalise, pcBalise);\n" \
18619  " pt_fin_lst = buf_concat + strlen(buf_concat);\n" \
18620  "\n" \
18621  " for (pt_debut = buf_concat; pt_debut < pt_fin_lst;)\n" \
18622  " {\n" \
18623  " pt_fin = strchr(pt_debut, '|');\n" \
18624  "\n" \
18625  " if (pt_fin == 0)\n" \
18626  " pt_fin = pt_fin_lst;\n" \
18627  "\n" \
18628  " /* analyse rang */\n" \
18629  " memcpy(tcRang, pt_debut, (pt_fin - pt_debut));\n" \
18630  " tcRang[(pt_fin - pt_debut)] = '\\0';\n" \
18631  " iRang = atoi(tcRang);\n" \
18632  " lg_write = giv_ecrit_balise_iso(buf_pos, (docClone + iRang)->value.intitule.denomination, tcBalise);\n" \
18633  " buf_pos = buf_pos + lg_write;\n" \
18634  " pt_debut = pt_fin + 1;\n" \
18635  " }\n" \
18636  " }\n" \
18637  "\n" \
18638  " if ('\\0' != buf_concat[10000])\n" \
18639  " {\n" \
18640  " iIntRet = supprimer_doublon(&buf_concat[10000], '|');\n" \
18641  " strcpy(tcBalise, \"pjobjet\");\n" \
18642  " strcat(tcBalise, pcBalise);\n" \
18643  " pt_fin_lst = &buf_concat[10000] + strlen(&buf_concat[10000]);\n" \
18644  "\n" \
18645  " for (pt_debut = &buf_concat[10000]; pt_debut < pt_fin_lst;)\n" \
18646  " {\n" \
18647  " pt_fin = strchr(pt_debut, '|');\n" \
18648  "\n" \
18649  " if (pt_fin == 0)\n" \
18650  " pt_fin = pt_fin_lst;\n" \
18651  "\n" \
18652  " /* analyse rang */\n" \
18653  " memcpy(tcRang, pt_debut, (pt_fin - pt_debut));\n" \
18654  " tcRang[(pt_fin - pt_debut)] = '\\0';\n" \
18655  " iRang = atoi(tcRang);\n" \
18656  "\n" \
18657  " for (i = 0; (i < givrListObj.iNbr && iRang != givrListObj.trEltListObj[i].iRangTri); i++)\n" \
18658  " ;\n" \
18659  "\n" \
18660  " iRang = givrListObj.trEltListObj[i].iRgLigne;\n" \
18661  " iObj = givrListObj.trEltListObj[i].iRgObj;\n" \
18662  " iIntRet = giv_ecrit_objet_pub(&buf_pos, docClone, iRang, iObj, tcBalise);\n" \
18663  " pt_debut = pt_fin + 1;\n" \
18664  " }\n" \
18665  " }\n" \
18666  "\n" \
18667  " *buf_pos_in = buf_pos;\n" \
18668  " return (iCodRet);\n" \
18669  "} /* Fin ecrit partie_3_an9 */\n" \
18670  "\n" \
18671  "/*----Fonction----------------------------------------------------------------*/\n" \
18672  "/* */\n" \
18673  "/* Fonction : giv_ecrit_partie_3 () */\n" \
18674  "/* */\n" \
18675  "/* But : ecrit la partie trois du clone */\n" \
18676  "/* */\n" \
18677  "/* */\n" \
18678  "/* Entree(s) : un buffer, Structure Document */\n" \
18679  "/* */\n" \
18680  "/* Sortie(s) : OK ou KO */\n" \
18681  "/* */\n" \
18682  "/* Portable : Transparent */\n" \
18683  "/* */\n" \
18684  "/*----------------------------------------------------------------------------*/\n" \
18685  "\n" \
18686  "int4 giv_ecrit_partie_3(char** buf_pos_in, GYBrDOCUMENTEpj* docClone, int4 indice, int4 iTri)\n" \
18687  "{\n" \
18688  " int4 lg; /* Logueur du champ à traiter */\n" \
18689  " int4 lg_write;\n" \
18690  " char* buf_pos;\n" \
18691  " int4 iCodRet, iRet; /* Code retour de la fonction */\n" \
18692  " int4 pipe; /* Flag pour ajout pipe */\n" \
18693  " int4 i, j, k, l, m, mm, n, p, q;\n" \
18694  " int4 iRef;\n" \
18695  " int4 jRef, jInit;\n" \
18696  " int4 iTrouve;\n" \
18697  " int4 iIntRet = GIV::GWCCodeOK;\n" \
18698  " int4 iNbrRangRub;\n" \
18699  " int4 iRgRubDbl, iRang, iObj;\n" \
18700  " char tcRang[4 + 1];\n" \
18701  " char tcDeploc[GYBIeinscLgDeppar + GYBIeinscLgLocpar + 1];\n" \
18702  " int4 iNbGeoRub;\n" \
18703  " int4 iNbRub;\n" \
18704  " int4 iParuInst;\n" \
18705  " int4 iCountMC;\n" \
18706  " char* pt_fin_lst;\n" \
18707  " char* pt_debut;\n" \
18708  " char* pt_fin;\n" \
18709  " iCodRet = GIV::GWCCodeOK;\n" \
18710  " /* Initialisation pointeur */\n" \
18711  " buf_pos = *buf_pos_in;\n" \
18712  " /* boucle sur rubrique */\n" \
18713  " GWTTrace(GWT_NIV_FONCT, (\"Partie 3 Nombre de tris [%d]\\n\", givrListParu.iNbrTri));\n" \
18714  " pipe = 0;\n" \
18715  " buf_concat[0] = '\\0';\n" \
18716  " docClone->iSource = 1;\n" \
18717  "\n" \
18718  " for (i = 1; i < indice; i++)\n" \
18719  " (docClone + i)->iSource = docClone->iSource;\n" \
18720  "\n" \
18721  " i = 0;\n" \
18722  " j = 0;\n" \
18723  " pipe = 0;\n" \
18724  "\n" \
18725  " for (n = 0; n < givrListParu.iNbrTri; n++)\n" \
18726  " {\n" \
18727  " if ((GIV::giv_RUB == iTri) && ('\\0' != GIVBuffXML[0]))\n" \
18728  " {\n" \
18729  " /* Ecriture dans le fichier de sortie */\n" \
18730  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
18731  " }\n" \
18732  "\n" \
18733  " jRef = giv_ecrit_partie_30(&buf_pos, n, iTri);\n" \
18734  "\n" \
18735  " if ((GIV::giv_RUB == iTri) && ('\\0' != GIVBuffXML[0]))\n" \
18736  " {\n" \
18737  " /* Ecriture dans le fichier de sortie en UTF8 */\n" \
18738  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
18739  " }\n" \
18740  "\n" \
18741  " if (-1 == jRef)\n" \
18742  " continue;\n" \
18743  "\n" \
18744  " j = jRef;\n" \
18745  " l = givrListParu.trEltRangList[j];\n" \
18746  " m = givrListParu.trEltList[l].iRangTri;\n" \
18747  " mm = givrListParu.trEltList[l].iRgTriDbl;\n" \
18748  " /* analyse des données géographiques des doubles */\n" \
18749  " memset(buf_concat, 0, strlen(buf_concat));\n" \
18750  " pipe = 0;\n" \
18751  " i = 0;\n" \
18752  " /* Pour deplocarr */\n" \
18753  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, 0, m, GIV::giv_ARR, GIV::giv_ARR, \"pjdeplocarr\");\n" \
18754  "\n" \
18755  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18756  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_ARR, GIV::giv_ARR, \"deplocarr\");\n" \
18757  "\n" \
18758  " /* deplocarrextra */\n" \
18759  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_ARR, GIV::giv_LOC, \"pjdeplocarrextra\");\n" \
18760  "\n" \
18761  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18762  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_ARR, GIV::giv_LOC, \"deplocarrextra\");\n" \
18763  "\n" \
18764  " /* Pour deploc */\n" \
18765  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_LOC, GIV::giv_LOC, \"pjdeploc\");\n" \
18766  "\n" \
18767  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18768  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_LOC, GIV::giv_LOC, \"deploc\");\n" \
18769  "\n" \
18770  " /* Pour deploczoneurbaine */\n" \
18771  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_LOC, GIV::giv_ZU, \"pjdeploczoneurbaine\");\n" \
18772  "\n" \
18773  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18774  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_LOC, GIV::giv_ZU, \"deploczoneurbaine\");\n" \
18775  "\n" \
18776  " /* Pour deplocZuv */\n" \
18777  " iIntRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_LOC, GIV::giv_ZV, \"pjdeplocZuv\");\n" \
18778  "\n" \
18779  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18780  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_LOC, GIV::giv_ZV, \"deplocZuv\");\n" \
18781  "\n" \
18782  " /* Pour deplocextraloc */\n" \
18783  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_LOC, GIV::giv_DEPT, \"pjdeplocextraloc\");\n" \
18784  "\n" \
18785  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18786  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_LOC, GIV::giv_DEPT, \"deplocextraloc\");\n" \
18787  "\n" \
18788  " /* deplocarrextraloc */\n" \
18789  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_ARR, GIV::giv_DEPT, \"pjdeplocarrextraloc\");\n" \
18790  "\n" \
18791  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18792  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_ARR, GIV::giv_DEPT, \"deplocarrextraloc\");\n" \
18793  "\n" \
18794  " /* deplocuv */\n" \
18795  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_LOC, GIV::giv_UV, \"pjdeplocuv\");\n" \
18796  "\n" \
18797  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18798  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_LOC, GIV::giv_UV, \"pjdeplocuv\");\n" \
18799  "\n" \
18800  " /* deplocarruv */\n" \
18801  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_ARR, GIV::giv_UV, \"pjdeplocarruv\");\n" \
18802  "\n" \
18803  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18804  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_ARR, GIV::giv_UV, \"pjdeplocarruv\");\n" \
18805  "\n" \
18806  " /* Pour deplocextradep */\n" \
18807  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_LOC, GIV::giv_EXTL, \"pjdeplocextradep\");\n" \
18808  "\n" \
18809  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18810  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_LOC, GIV::giv_EXTL, \"deplocextradep\");\n" \
18811  "\n" \
18812  " /* deplocarrextradep */\n" \
18813  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_ARR, GIV::giv_EXTL, \"pjdeplocarrextradep\");\n" \
18814  "\n" \
18815  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18816  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_ARR, GIV::giv_EXTL, \"deplocarrextradep\");\n" \
18817  "\n" \
18818  " /* Pour dep */\n" \
18819  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_DEPT, GIV::giv_DEPT, \"pjdep\");\n" \
18820  "\n" \
18821  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18822  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_DEPT, GIV::giv_DEPT, \"dep\");\n" \
18823  "\n" \
18824  " /* Pour depextra */\n" \
18825  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_DEPT, GIV::giv_EXTL, \"pjdepextra\");\n" \
18826  "\n" \
18827  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18828  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_DEPT, GIV::giv_EXTL, \"depextra\");\n" \
18829  "\n" \
18830  " /* Pour reg */\n" \
18831  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_REG, GIV::giv_REG, \"pjreg\");\n" \
18832  "\n" \
18833  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18834  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_REG, GIV::giv_REG, \"reg\");\n" \
18835  "\n" \
18836  " /* Pour regextra */\n" \
18837  " iRet = giv_ecrit_partie_3_geo(&buf_pos, docClone, jRef, m, GIV::giv_REG, GIV::giv_EXTL, \"pjregextra\");\n" \
18838  "\n" \
18839  " if ((GIV::GWCCodeOK == iRet) && (GIV::giv_RUB == iTri))\n" \
18840  " iRet = giv_ecrit_partie_3_an9(&buf_pos, docClone, mm, GIV::giv_REG, GIV::giv_EXTL, \"regextra\");\n" \
18841  "\n" \
18842  " if (GIV::giv_RUB == iTri)\n" \
18843  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"parutionrubriques\");\n" \
18844  " else if (GIV::giv_DNOM == iTri)\n" \
18845  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"parutiondenoms\");\n" \
18846  " else if (GIV::giv_OBJ == iTri)\n" \
18847  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"parutionobjets\");\n" \
18848  "\n" \
18849  " buf_pos = buf_pos + lg_write;\n" \
18850  " /* tri suivant */\n" \
18851  " }\n" \
18852  "\n" \
18853  " *buf_pos_in = buf_pos;\n" \
18854  " return (iCodRet);\n" \
18855  "} /* Fin ecrit partie_3 */\n" \
18856  "\n" \
18857  "/*----Fonction----------------------------------------------------------------*/\n" \
18858  "/* */\n" \
18859  "/* Fonction :giv_sortie_ISO () */\n" \
18860  "/* */\n" \
18861  "/* But : écriture ISO du fichier de sortie */\n" \
18862  "/* */\n" \
18863  "/* */\n" \
18864  "/* */\n" \
18865  "/* */\n" \
18866  "/* Entree(s) : */\n" \
18867  "/* */\n" \
18868  "/* Sortie(s) : OK ou KO */\n" \
18869  "/* */\n" \
18870  "/* Portable : Transparent */\n" \
18871  "/* */\n" \
18872  "/*----------------------------------------------------------------------------*/\n" \
18873  "static int4 giv_sortie_ISO(char** buf_pos_in, FILE* afDescFic)\n" \
18874  "{\n" \
18875  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
18876  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
18877  " int4 lg_a_ecrire = 0;\n" \
18878  " char* buf_pos;\n" \
18879  " /* Calcul de la longueur a ecrire */\n" \
18880  " lg_a_ecrire = strlen(GIVBuffXML);\n" \
18881  " GWTTrace(GWT_NIV_FONCT, (\"Enrichissement %d,%d \\n\", giviEnrich, giviCodRetEcr));\n" \
18882  "\n" \
18883  " if ((NULL != afDescFic) && (0 != lg_a_ecrire) && ((int4)GIV::GIXCodeOK == giviCodRetEcr))\n" \
18884  " {\n" \
18885  " GWTTrace(GWT_NIV_FONCT, (\"On passe dans l'ecriture du fichier de sortie ISO \\n\"));\n" \
18886  " /* ecriture de l'enregistrement dans le fichier de sortie */\n" \
18887  " GWTTrace(GWT_NIV_FONCT, (\"Taille du buff a ecrire dans le fic XML : %d\\n\", lg_a_ecrire));\n" \
18888  " /* Conversion du buffer avant écriture dans le fichier */\n" \
18889  " givTradChar(&lg_a_ecrire);\n" \
18890  " /* ecriture de l'enregistrement dans le fichier de sortie */\n" \
18891  " GWTTrace(GWT_NIV_FONCT, (\"Taille du buff UTF8 a ecrire dans le fic XML : %d,%d\\n\", strlen(GIVBuffTest), lg_a_ecrire));\n" \
18892  "\n" \
18893  " if ((int4)GIV::GIXCodeOK != giviEnrich)\n" \
18894  " {\n" \
18895  " /* Ecriture dans le fichier de sortie */\n" \
18896  " iIntRet = (int4)fwrite(GIVBuffXML, lg_a_ecrire, 1, afDescFic);\n" \
18897  " }\n" \
18898  " /* utilisation du buffer de cas de test */\n" \
18899  " else if ((strlen(GIVBuffTest) + strlen(GIVBuffXML)) > giv_LG_BUFFTEST)\n" \
18900  " {\n" \
18901  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : taille du bloc %d supérieure à %d octets\\n\", (strlen(GIVBuffTest) + strlen(GIVBuffXML)), giv_LG_BUFFTEST));\n" \
18902  " giviCodRetEcr = (int4)GIV::GIXCodeKO;\n" \
18903  " }\n" \
18904  " else\n" \
18905  " {\n" \
18906  " strcat(GIVBuffTest, GIVBuffXML);\n" \
18907  " iIntRet = 1;\n" \
18908  " }\n" \
18909  "\n" \
18910  " if (1 != iIntRet)\n" \
18911  " {\n" \
18912  " /* Erreur d'ecriture mouvement CD */\n" \
18913  " GWTTrace(GWT_NIV_FONCT, (\"Erreur ecriture sur fichier MCD : [ERR=%02Xh]\\n\", errno));\n" \
18914  " GWTTrace(GWT_NIV_FONCT, (\"Erreur ecriture sur fichier MCD, code retour fwrite : %d\\n\", iIntRet));\n" \
18915  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
18916  " }\n" \
18917  " }\n" \
18918  "\n" \
18919  " if ((GIVfDescFicBloc == afDescFic) && (GIVfDescFicMCD != GIVfDescFicBloc) && (0 != lg_a_ecrire))\n" \
18920  " {\n" \
18921  " /* Ecriture dans le fichier de sortie */\n" \
18922  " iIntRet = (int4)fwrite(GIVBuffXML, lg_a_ecrire, 1, GIVfDescFicMCD);\n" \
18923  "\n" \
18924  " if (1 != iIntRet)\n" \
18925  " {\n" \
18926  " /* Erreur d'ecriture mouvement CD */\n" \
18927  " GWTTrace(GWT_NIV_FONCT, (\"Erreur ecriture sur fichier MCD : [ERR=%02Xh]\\n\", errno));\n" \
18928  " GWTTrace(GWT_NIV_FONCT, (\"Erreur ecriture sur fichier MCD, code retour fwrite : %d\\n\", iIntRet));\n" \
18929  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
18930  " }\n" \
18931  " }\n" \
18932  "\n" \
18933  " /* Effacement du buffer */\n" \
18934  " GIVBuffXML[0] = '\\0';\n" \
18935  " /* Pointeur sur debut du buffer */\n" \
18936  " buf_pos = GIVBuffXML;\n" \
18937  " *buf_pos_in = buf_pos;\n" \
18938  " return (iCodRet);\n" \
18939  "}\n" \
18940  "\n" \
18941  "/*----Fonction----------------------------------------------------------------*/\n" \
18942  "/* */\n" \
18943  "/* Fonction :giv_sortie_ () */\n" \
18944  "/* */\n" \
18945  "/* But : écriture du fichier de sortie format inchangé */\n" \
18946  "/* */\n" \
18947  "/* */\n" \
18948  "/* */\n" \
18949  "/* */\n" \
18950  "/* Entree(s) : */\n" \
18951  "/* */\n" \
18952  "/* Sortie(s) : OK ou KO */\n" \
18953  "/* */\n" \
18954  "/* Portable : Transparent */\n" \
18955  "/* */\n" \
18956  "/*----------------------------------------------------------------------------*/\n" \
18957  "static int4 giv_sortie(char** buf_pos_in, FILE* afDescFic)\n" \
18958  "{\n" \
18959  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
18960  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
18961  " int4 lg_a_ecrire = 0;\n" \
18962  " char* buf_pos;\n" \
18963  " /* Calcul de la longueur a ecrire */\n" \
18964  " lg_a_ecrire = strlen(GIVBuffXML);\n" \
18965  " GWTTrace(GWT_NIV_FONCT, (\"Enrichissement %d,%d \\n\", giviEnrich, giviCodRetEcr));\n" \
18966  "\n" \
18967  " if ((NULL != afDescFic) && (0 != lg_a_ecrire) && ((int4)GIV::GIXCodeOK == giviCodRetEcr))\n" \
18968  " {\n" \
18969  " GWTTrace(GWT_NIV_FONCT, (\"On passe dans l'ecriture du fichier de sortie UTF8 \\n\"));\n" \
18970  " /* ecriture de l'enregistrement dans le fichier de sortie */\n" \
18971  " GWTTrace(GWT_NIV_FONCT, (\"Taille du buff a ecrire dans le fic XML : %d\\n\", lg_a_ecrire));\n" \
18972  "\n" \
18973  " if ((int4)GIV::GIXCodeOK != giviEnrich)\n" \
18974  " {\n" \
18975  " /* Ecriture dans le fichier de sortie */\n" \
18976  " iIntRet = (int4)fwrite(GIVBuffXML, lg_a_ecrire, 1, afDescFic);\n" \
18977  " }\n" \
18978  " /* utilisation du buffer de cas de test */\n" \
18979  " else if ((strlen(GIVBuffTest) + strlen(GIVBuffXML)) > giv_LG_BUFFTEST)\n" \
18980  " {\n" \
18981  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : taille du bloc %d supérieure à %d octets\\n\", (strlen(GIVBuffTest) + strlen(GIVBuffXML)), giv_LG_BUFFTEST));\n" \
18982  " giviCodRetEcr = (int4)GIV::GIXCodeKO;\n" \
18983  " }\n" \
18984  " else\n" \
18985  " {\n" \
18986  " strcat(GIVBuffTest, GIVBuffXML);\n" \
18987  " iIntRet = 1;\n" \
18988  " }\n" \
18989  "\n" \
18990  " if (1 != iIntRet)\n" \
18991  " {\n" \
18992  " /* Erreur d'ecriture mouvement CD */\n" \
18993  " GWTTrace(GWT_NIV_FONCT, (\"Erreur ecriture sur fichier MCD : [ERR=%02Xh]\\n\", errno));\n" \
18994  " GWTTrace(GWT_NIV_FONCT, (\"Erreur ecriture sur fichier MCD, code retour fwrite : %d\\n\", iIntRet));\n" \
18995  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
18996  " }\n" \
18997  " }\n" \
18998  "\n" \
18999  " if ((GIVfDescFicBloc == afDescFic) && (GIVfDescFicMCD != GIVfDescFicBloc) && (0 != lg_a_ecrire))\n" \
19000  " {\n" \
19001  " /* Ecriture dans le fichier de sortie */\n" \
19002  " iIntRet = (int4)fwrite(GIVBuffXML, lg_a_ecrire, 1, GIVfDescFicMCD);\n" \
19003  "\n" \
19004  " if (1 != iIntRet)\n" \
19005  " {\n" \
19006  " /* Erreur d'ecriture mouvement CD */\n" \
19007  " GWTTrace(GWT_NIV_FONCT, (\"Erreur ecriture sur fichier MCD : [ERR=%02Xh]\\n\", errno));\n" \
19008  " GWTTrace(GWT_NIV_FONCT, (\"Erreur ecriture sur fichier MCD, code retour fwrite : %d\\n\", iIntRet));\n" \
19009  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
19010  " }\n" \
19011  " }\n" \
19012  "\n" \
19013  " /* Effacement du buffer */\n" \
19014  " GIVBuffXML[0] = '\\0';\n" \
19015  " /* Pointeur sur debut du buffer */\n" \
19016  " buf_pos = GIVBuffXML;\n" \
19017  " *buf_pos_in = buf_pos;\n" \
19018  " return (iCodRet);\n" \
19019  "}\n" \
19020  "\n" \
19021  "/*----Fonction----------------------------------------------------------------*/\n" \
19022  "/* */\n" \
19023  "/* Fonction : givFin () */\n" \
19024  "/* */\n" \
19025  "/* But : Fin de tous les blocs */\n" \
19026  "/* */\n" \
19027  "/* */\n" \
19028  "/* */\n" \
19029  "/* Entree(s) : la structure XML d'un bloc */\n" \
19030  "/* */\n" \
19031  "/* Sortie(s) : OK ou KO */\n" \
19032  "/* */\n" \
19033  "/* Portable : Transparent */\n" \
19034  "/* */\n" \
19035  "/*----------------------------------------------------------------------------*/\n" \
19036  "\n" \
19037  "static int4 givFin(char** buf_pos_in, char* blocid)\n" \
19038  "{\n" \
19039  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
19040  " int4 lg_write;\n" \
19041  " char* buf_pos;\n" \
19042  " int4 iIntRet = GIV::GWCCodeOK;\n" \
19043  " /* Initialisation pointeur */\n" \
19044  " buf_pos = *buf_pos_in;\n" \
19045  "\n" \
19046  " if ((int4)GIV::GWCCodeOK == iCodRet)\n" \
19047  " GWTTrace(GWT_NIV_FONCT, (\"Fin ECRITURE PARTIE_3 ..debut Fin.\\n\"));\n" \
19048  "\n" \
19049  " if ('\\0' != GIVBuffXML[0])\n" \
19050  " {\n" \
19051  " /* Ecriture dans le fichier de sortie */\n" \
19052  " if (0 == strcmp(\"OUI\", givtcContenu))\n" \
19053  " iIntRet = (int4)giv_sortie_ISO(&buf_pos, GIVfDescFicMCD);\n" \
19054  " else\n" \
19055  " iIntRet = giv_fichier_sortie(&buf_pos, &GIVfDescFicMCD);\n" \
19056  " }\n" \
19057  "\n" \
19058  " /* fermeture du fichier */\n" \
19059  " iIntRet = (int4)giv_fermeture_fichier_sortie(&buf_pos, blocid);\n" \
19060  "\n" \
19061  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
19062  " {\n" \
19063  " GWTTrace(GWT_NIV_FONCT, (\"pas de fichier de sortie\\n\"));\n" \
19064  " iCodRet = GIV::GWCCodeKO;\n" \
19065  " }\n" \
19066  "\n" \
19067  " *buf_pos_in = buf_pos;\n" \
19068  " return (iCodRet);\n" \
19069  "} /* Fin Documents */\n" \
19070  "\n" \
19071  "/*----Fonction----------------------------------------------------------------*/\n" \
19072  "/* */\n" \
19073  "/* Fonction :giv_fichier_sortie () */\n" \
19074  "/* */\n" \
19075  "/* But : Creation du fichier de sortie pr chaque bloc de parution */\n" \
19076  "/* */\n" \
19077  "/* */\n" \
19078  "/* */\n" \
19079  "/* */\n" \
19080  "/* Entree(s) : */\n" \
19081  "/* */\n" \
19082  "/* Sortie(s) : OK ou KO */\n" \
19083  "/* */\n" \
19084  "/* Portable : Transparent */\n" \
19085  "/* */\n" \
19086  "/*----------------------------------------------------------------------------*/\n" \
19087  "static int4 giv_fichier_sortie(char** buf_pos_in, FILE** apfDescFic)\n" \
19088  "{\n" \
19089  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
19090  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
19091  " char cChemin[128] = \"\"; /* Pathname des fichiers utilises */\n" \
19092  " char cNomFichier[128] = \"\"; /* Pathname des fichiers utilises */\n" \
19093  " char cNomFichier1[256] = \"\"; /* Pathname des fichiers utilises */\n" \
19094  " char cNomFichier3[256] = \"\"; /* Pathname des fichiers utilises */\n" \
19095  " int4 lg_a_ecrire; /* Longueur du contenu de buffer : a ecrire */\n" \
19096  " int4 lg_ecrit_entete = 0;\n" \
19097  " char cEntete_xml[100] = \"<?xml version=\\\"1.0\\\" encoding=\\\"ISO-8859-1\\\" ?>\";\n" \
19098  " char cEntete_xml0[] = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" ?>\";\n" \
19099  " char cEntete_xml1[] = \"<!DOCTYPE sgipro [\";\n" \
19100  " char cEntete_xml2[] = \"<!ENTITY euro \\\"&#8364;\\\" >\";\n" \
19101  " char cEntete_xml3[] = \"<!ENTITY laquo \\\"&#171;\\\" >\";\n" \
19102  " char cEntete_xml4[] = \"<!ENTITY raquo \\\"&#187;\\\" >\";\n" \
19103  " char cEntete_xml5[] = \"<!ENTITY quot \\\"&#34;\\\" >\";\n" \
19104  " char cEntete_xml6[] = \"]>\";\n" \
19105  " char* buf_pos;\n" \
19106  " char tcNumMvt[GXWLgIdDonnees];\n" \
19107  " char* pcVersion = NULL;\n" \
19108  " char conf[50];\n" \
19109  " GWTTrace(GWT_NIV_FONCT, (\"On passe dans l'ecriture du fichier de sortie %d,%d,%d\\n\", num_id, giviNbBlocs, giviClose));\n" \
19110  " buf_pos = *buf_pos_in;\n" \
19111  "\n" \
19112  " if ((0 != num_id) && (0 == (num_id % giviNbBlocs)) && (-1 != giviNbBlocs) && ((int4)GIV::GIXCodeKO == giviClose))\n" \
19113  " {\n" \
19114  " giviClose = (int4)GIV::GIXCodeOK;\n" \
19115  " giviNumFic = giviNumFicInit + (num_id / giviNbBlocs);\n" \
19116  " }\n" \
19117  "\n" \
19118  " if ((NULL == *apfDescFic) && (('\\0' != GIVBuffXML[0]) || ((int4)GIV::GIXCodeKO == giviClose)))\n" \
19119  " {\n" \
19120  " /* nouveau fichier */\n" \
19121  " /* Initialisation des variables locales */\n" \
19122  " (void)memset((void*)cChemin, 0x00, (size_t)sizeof(cChemin));\n" \
19123  " (void)memset((void*)cNomFichier, 0x00, (size_t)sizeof(cNomFichier));\n" \
19124  " /* ouverture du fichier des mouvements CD2G */\n" \
19125  " /* constitution du nom du fichier */\n" \
19126  " /* constitution du nom du fichier Bloc */\n" \
19127  " (void)sprintf(conf, \"%s_%s\", \"GXXPathCd2g\", GIXcNomDest);\n" \
19128  " iIntRet = GWTLireConf(conf, cChemin);\n" \
19129  "\n" \
19130  " if (GIV::GWTok != iIntRet)\n" \
19131  " {\n" \
19132  " (void)strcpy(cChemin, \"/DATA/DEPT/CD2G\");\n" \
19133  " GWTTrace(GWT_NIV_BIZAR, (\"Pas de Path des mvts interne dans la conf. Valeur par defaut <%s> prise \\n\", cChemin));\n" \
19134  " }\n" \
19135  "\n" \
19136  " if (-1 == giviNbBlocs)\n" \
19137  " {\n" \
19138  " (void)sprintf(&cNomFichier[0], \"%s/%s/%s.%s.%s.xml\", cChemin, givcRepertoire, GIXtcNomFichier, GIXcNomDest, givcRepertoire);\n" \
19139  " (void)sprintf(&cNomFichier1[0], \"%s/%s/CFLT.%s.%s.%s.xml\", cChemin, givcRepertoire, GIXtcNomFichier, GIXcNomDest, givcRepertoire);\n" \
19140  " (void)sprintf(&cNomFichier3[0], \"%s/%s/ETB.%s.%s.%s\", cChemin, givcRepertoire, GIXtcNomFichier, GIXcNomDest, givcRepertoire);\n" \
19141  " }\n" \
19142  " else\n" \
19143  " {\n" \
19144  " (void)sprintf(&cNomFichier[0], \"%s/%s/%s.%s.%s.%d.xml\", cChemin, givcRepertoire, GIXtcNomFichier, GIXcNomDest, givcRepertoire, giviNumFic);\n" \
19145  " (void)sprintf(&cNomFichier1[0], \"%s/%s/CFLT.%s.%s.%s.%d.xml\", cChemin, givcRepertoire, GIXtcNomFichier, GIXcNomDest, givcRepertoire, giviNumFic);\n" \
19146  " (void)sprintf(&cNomFichier3[0], \"%s/%s/ETB.%s.%s.%s.%d\", cChemin, givcRepertoire, GIXtcNomFichier, GIXcNomDest, givcRepertoire, giviNumFic);\n" \
19147  " }\n" \
19148  "\n" \
19149  " GWTTrace(GWT_NIV_FONCT, (\"Nom fichier mouvements CD2G <%s>\\n\", cNomFichier));\n" \
19150  " /* Ouverture fichier des mouvements CD2G */\n" \
19151  " *apfDescFic = fopen64(cNomFichier,\n" \
19152  " GIV_FCREAT);\n" \
19153  "\n" \
19154  " if (NULL == *apfDescFic)\n" \
19155  " {\n" \
19156  " /* Echec ouverture fichier mouvements => erreur */\n" \
19157  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur FOPEN fichier mouvements CD : [ERR=%02Xh, PTH=%s]\\n\", errno, cNomFichier));\n" \
19158  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
19159  " }\n" \
19160  "\n" \
19161  " GIVfDescFicCFLT = NULL;\n" \
19162  " GIVfDescFicETB = NULL;\n" \
19163  " /* Preparation du header XML dans le fichier de sortie */\n" \
19164  " strcpy(buf_concat, cEntete_xml0);\n" \
19165  " lg_ecrit_entete = strlen(cEntete_xml0);\n" \
19166  " *(buf_concat + lg_ecrit_entete) = SEPARE_LIGNE;\n" \
19167  " *(buf_concat + lg_ecrit_entete + 1) = LINE_FEED;\n" \
19168  " lg_ecrit_entete = lg_ecrit_entete + 2;\n" \
19169  " strcpy(&buf_concat[lg_ecrit_entete], cEntete_xml1);\n" \
19170  " lg_ecrit_entete += strlen(cEntete_xml1);\n" \
19171  " *(buf_concat + lg_ecrit_entete) = SEPARE_LIGNE;\n" \
19172  " *(buf_concat + lg_ecrit_entete + 1) = LINE_FEED;\n" \
19173  " lg_ecrit_entete = lg_ecrit_entete + 2;\n" \
19174  " strcpy(&buf_concat[lg_ecrit_entete], cEntete_xml2);\n" \
19175  " lg_ecrit_entete += strlen(cEntete_xml2);\n" \
19176  " *(buf_concat + lg_ecrit_entete) = SEPARE_LIGNE;\n" \
19177  " *(buf_concat + lg_ecrit_entete + 1) = LINE_FEED;\n" \
19178  " lg_ecrit_entete = lg_ecrit_entete + 2;\n" \
19179  " strcpy(&buf_concat[lg_ecrit_entete], cEntete_xml3);\n" \
19180  " lg_ecrit_entete += strlen(cEntete_xml3);\n" \
19181  " *(buf_concat + lg_ecrit_entete) = SEPARE_LIGNE;\n" \
19182  " *(buf_concat + lg_ecrit_entete + 1) = LINE_FEED;\n" \
19183  " lg_ecrit_entete = lg_ecrit_entete + 2;\n" \
19184  " strcpy(&buf_concat[lg_ecrit_entete], cEntete_xml4);\n" \
19185  " lg_ecrit_entete += strlen(cEntete_xml3);\n" \
19186  " *(buf_concat + lg_ecrit_entete) = SEPARE_LIGNE;\n" \
19187  " *(buf_concat + lg_ecrit_entete + 1) = LINE_FEED;\n" \
19188  " lg_ecrit_entete = lg_ecrit_entete + 2;\n" \
19189  " strcpy(&buf_concat[lg_ecrit_entete], cEntete_xml5);\n" \
19190  " lg_ecrit_entete += strlen(cEntete_xml5);\n" \
19191  " *(buf_concat + lg_ecrit_entete) = SEPARE_LIGNE;\n" \
19192  " *(buf_concat + lg_ecrit_entete + 1) = LINE_FEED;\n" \
19193  " lg_ecrit_entete = lg_ecrit_entete + 2;\n" \
19194  " strcpy(&buf_concat[lg_ecrit_entete], cEntete_xml6);\n" \
19195  " lg_ecrit_entete += strlen(cEntete_xml6);\n" \
19196  " *(buf_concat + lg_ecrit_entete) = SEPARE_LIGNE;\n" \
19197  " *(buf_concat + lg_ecrit_entete + 1) = LINE_FEED;\n" \
19198  " lg_ecrit_entete = lg_ecrit_entete + 2;\n" \
19199  " /* Ajout de la ligne <operations> */\n" \
19200  " strcpy(&buf_concat[lg_ecrit_entete], \"<OPERATIONS>\");\n" \
19201  " lg_ecrit_entete = strlen(buf_concat);\n" \
19202  " *(buf_concat + lg_ecrit_entete) = SEPARE_LIGNE;\n" \
19203  " *(buf_concat + lg_ecrit_entete + 1) = LINE_FEED;\n" \
19204  " *(buf_concat + lg_ecrit_entete + 2) = '\\0';\n" \
19205  " lg_ecrit_entete = lg_ecrit_entete + 2;\n" \
19206  " /* ecriture du contenu du header dans le fichier de sortie */\n" \
19207  " iIntRet = (int4)fwrite(buf_concat, lg_ecrit_entete, 1, *apfDescFic);\n" \
19208  "\n" \
19209  " if (1 != iIntRet)\n" \
19210  " {\n" \
19211  " /* probleme d'ecriture de l'entete */\n" \
19212  " GWTTrace(GWT_NIV_GRAVE, (\"Probleme d'ecriture de l'entete pour le dept [%s]\\n\", GIXcDepartement));\n" \
19213  " iCodRet = GIV::GIXCodeKO;\n" \
19214  " }\n" \
19215  "\n" \
19216  " /* Init buffer de cas de test */\n" \
19217  " GIVBuffTest[0] = '\\0';\n" \
19218  " }\n" \
19219  "\n" \
19220  " if (((int4)GIV::GWCCodeOK == iCodRet) && ('\\0' != GIVBuffXML[0]))\n" \
19221  " {\n" \
19222  " /* Ecriture dans le fichier de sortie */\n" \
19223  " iIntRet = (int4)giv_sortie_ISO(&buf_pos, *apfDescFic);\n" \
19224  " }\n" \
19225  "\n" \
19226  " *buf_pos_in = buf_pos;\n" \
19227  " return (iCodRet);\n" \
19228  "}\n" \
19229  "\n" \
19230  "/*----Fonction----------------------------------------------------------------*/\n" \
19231  "/* */\n" \
19232  "/* Fonction :giv_fichier_sortie_cflt () */\n" \
19233  "/* */\n" \
19234  "/* But : Creation du fichier de sortie de conflit */\n" \
19235  "/* de balise de contenu selon priorité */\n" \
19236  "/* */\n" \
19237  "/* */\n" \
19238  "/* */\n" \
19239  "/* */\n" \
19240  "/* Entree(s) : */\n" \
19241  "/* */\n" \
19242  "/* Sortie(s) : OK ou KO */\n" \
19243  "/* */\n" \
19244  "/* Portable : Transparent */\n" \
19245  "/* */\n" \
19246  "/*----------------------------------------------------------------------------*/\n" \
19247  "static int4 giv_fichier_sortie_cflt(int4 aiRg, GYBrDOCUMENTEpj* doc, GYBrPrioCRCT* prPrioCRC)\n" \
19248  "{\n" \
19249  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
19250  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
19251  " char buf[200];\n" \
19252  " int4 lg_ecrit = 0;\n" \
19253  " GWTTrace(GWT_NIV_FONCT, (\"On passe dans l'ecriture du fichier de conflit \\n\"));\n" \
19254  " strcpy(&buf[0], \"SCG\");\n" \
19255  " strcat(buf, \"|\");\n" \
19256  " strcat(buf, doc->parution_id);\n" \
19257  " strcat(buf, \"|\");\n" \
19258  " strcat(buf, doc->value.numero_client);\n" \
19259  " strcat(buf, \"|\");\n" \
19260  " /* source prioritaire pour le bloc */\n" \
19261  " strcat(buf, givrListCRC.trEltList[aiRg].acTpdsob);\n" \
19262  " strcat(buf, \"|\");\n" \
19263  " strcat(buf, givrListCRC.trEltList[aiRg].acEtab);\n" \
19264  " prPrioCRC->concatNotPriorityCriteria(buf);\n" \
19265  " lg_ecrit = strlen(buf);\n" \
19266  " buf[lg_ecrit] = SEPARE_LIGNE;\n" \
19267  " buf[lg_ecrit + 1] = LINE_FEED;\n" \
19268  " buf[lg_ecrit + 2] = '\\0';\n" \
19269  " lg_ecrit += 2;\n" \
19270  " /* ecriture du contenu dans le fichier de sortie */\n" \
19271  " iIntRet = (int4)fwrite(buf, lg_ecrit, 1, GIVfDescFicCFLT);\n" \
19272  "\n" \
19273  " if (1 != iIntRet)\n" \
19274  " {\n" \
19275  " /* probleme d'ecriture */\n" \
19276  " GWTTrace(GWT_NIV_GRAVE, (\"Probleme d'ecriture de conflit [%s]\\n\", doc->parution_id));\n" \
19277  " iCodRet = GIV::GIXCodeKO;\n" \
19278  " }\n" \
19279  "\n" \
19280  " return (iCodRet);\n" \
19281  "}\n" \
19282  "\n" \
19283  "/*----------------------------------Fonction----------------------------------*\n" \
19284  " * Fonction : givTriGeoIns\n" \
19285  " *\n" \
19286  " * But : Tri des codes géographiques par inscription\n" \
19287  " *\n" \
19288  " * Description :\n" \
19289  " * Fonction de tri des réponses en fonction d'un critère qui précise l'ordre\n" \
19290  " * de priorité des tris\n" \
19291  " *\n" \
19292  " * Portabilité : sûrement portable\n" \
19293  " *\n" \
19294  " * Interface :\n" \
19295  " *\n" \
19296  " * Paramètres :\n" \
19297  " *\n" \
19298  " * Valeurs retournées :\n" \
19299  " *\n" \
19300  " * Erreurs :\n" \
19301  " *\n" \
19302  " *---------------------------------Historique----------------------------------\n" \
19303  " *\n" \
19304  " * Création : Jan/29/2008 (mb)\n" \
19305  " *\n" \
19306  " * Modification (MMM/JJ/AAAA - xx) :\n" \
19307  " *\n" \
19308  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
19309  "\n" \
19310  "int4 givTriGeoIns(GYBrDOCUMENTEpj* doc, int4 indice)\n" \
19311  "{\n" \
19312  " int4 iCodRet; /* Code retour de la fonction */\n" \
19313  " int4 iIntRet; /* Code retour interne */\n" \
19314  " int4 iGeoArr, iGeoArrInst, iGeoLoc, iGeoDept, iGeoReg;\n" \
19315  " int4 i, j, k, q;\n" \
19316  " int4 pipe;\n" \
19317  " char tcCoddep[3 + 1];\n" \
19318  " char tcCodloc[5 + 1];\n" \
19319  " char tcLocfus[5 + 1];\n" \
19320  " /* Initialisation des variables locales */\n" \
19321  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
19322  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
19323  "\n" \
19324  " /* une seule installation traitée avec éventuellement plusieurs arr */\n" \
19325  "\n" \
19326  " if ((0 != strlen(doc->value.rubriques.depact)) && (0 != strlen(doc->value.rubriques.locact)))\n" \
19327  " {\n" \
19328  " /* utilisation des données d'activité */\n" \
19329  " strcpy(doc->value.inscription[0].cCoddep, doc->value.rubriques.depact);\n" \
19330  " strcpy(doc->value.inscription[0].cCodloc, doc->value.rubriques.locact);\n" \
19331  " }\n" \
19332  "\n" \
19333  " if (0 != strlen(doc->value.inscription[0].cCoddep))\n" \
19334  " {\n" \
19335  " (void)strcpy(tcCoddep, doc->value.inscription[0].cCoddep);\n" \
19336  "\n" \
19337  " if (0 != strcmp(givcLocFictive, doc->value.inscription[0].cCodloc))\n" \
19338  " (void)strcpy(tcCodloc, doc->value.inscription[0].cCodloc);\n" \
19339  " else\n" \
19340  " (void)strcpy(tcCodloc, givcLocIndf);\n" \
19341  " }\n" \
19342  " else if ((0 == strlen(doc->value.inscription[0].cCoddep)) && (0 != strcmp(givcDepFictif, doc->value.inscription[0].cDeppar)))\n" \
19343  " {\n" \
19344  " (void)strcpy(tcCoddep, doc->value.inscription[0].cDeppar);\n" \
19345  "\n" \
19346  " if (0 != strcmp(givcLocFictive, doc->value.inscription[0].cLocpar))\n" \
19347  " (void)strcpy(tcCodloc, doc->value.inscription[0].cLocpar);\n" \
19348  " else\n" \
19349  " (void)strcpy(tcCodloc, givcLocIndf);\n" \
19350  " }\n" \
19351  "\n" \
19352  " (void)strcpy(tcLocfus, doc->value.inscription[0].cLocFus);\n" \
19353  " givrListInst.iNbr = 1;\n" \
19354  " givrListInst.trEltRangList[0] = 0;\n" \
19355  " strcpy(givrListInst.trEltList[0].dep, tcCoddep);\n" \
19356  " strcpy(givrListInst.trEltList[0].loc, tcCodloc);\n" \
19357  " strcpy(givrListInst.trEltList[0].arr, \"99\");\n" \
19358  " givrListInst.trEltList[0].iGeoReg = 99;\n" \
19359  " givrListInst.trEltList[0].iGeoDept = 99;\n" \
19360  " givrListInst.trEltList[0].iGeoLoc = 99;\n" \
19361  " givrListInst.trEltList[0].iGeoArr = 99;\n" \
19362  " givrListInst.trEltList[0].iRangTri = (int4)0;\n" \
19363  "\n" \
19364  " if (0 != strlen(doc->value.rubriques.arract))\n" \
19365  " strcpy(givrListInst.trEltList[0].arr, doc->value.rubriques.arract);\n" \
19366  " else if (0 != strlen(doc->value.inscription[0].adresse.arrondissement))\n" \
19367  " strcpy(givrListInst.trEltList[0].arr, doc->value.inscription[0].adresse.arrondissement);\n" \
19368  "\n" \
19369  " if (0 != strlen(doc->value.inscription[0].cLocFus))\n" \
19370  " {\n" \
19371  " memcpy(&givrListInst.trEltList[givrListInst.iNbr], &givrListInst.trEltList[0], sizeof(GivrEltListTEpj));\n" \
19372  " (void)strcpy(givrListInst.trEltList[givrListInst.iNbr].loc, doc->value.inscription[0].cLocFus);\n" \
19373  " givrListInst.trEltRangList[givrListInst.iNbr] = givrListInst.iNbr;\n" \
19374  " givrListInst.iNbr++;\n" \
19375  " }\n" \
19376  "\n" \
19377  " givrListInst.iNbrTot = givrListInst.iNbr;\n" \
19378  " iGeoArrInst = GIV::giv_INIT_ARR;\n" \
19379  "\n" \
19380  " for (i = 0; i < givrListParu.iNbr; i++)\n" \
19381  " {\n" \
19382  " /* comparaison Parution/Installation */\n" \
19383  " iGeoReg = 99;\n" \
19384  " iGeoDept = 99;\n" \
19385  " iGeoLoc = 99;\n" \
19386  " iGeoArr = 99;\n" \
19387  " k = givrListParu.trEltRangList[i];\n" \
19388  "\n" \
19389  " if ((0 == strcmp(doc->value.inscription[0].cReg, givrListParu.trEltList[k].reg)) || (0 == strcmp(doc->value.inscription[0].cAncReg, givrListParu.trEltList[k].reg)))\n" \
19390  " {\n" \
19391  " /* même région */\n" \
19392  " iGeoReg = GIV::giv_REG;\n" \
19393  "\n" \
19394  " if (0 == strcmp(tcCoddep, givrListParu.trEltList[k].dep))\n" \
19395  " {\n" \
19396  " iGeoDept = GIV::giv_DEPT;\n" \
19397  "\n" \
19398  " if ((0 == strcmp(tcCodloc, givrListParu.trEltList[k].loc)) || (0 == strcmp(tcLocfus, givrListParu.trEltList[k].loc)))\n" \
19399  " {\n" \
19400  " /* inscription locale */\n" \
19401  " iGeoLoc = GIV::giv_LOC;\n" \
19402  " /* inscription locale : arr */\n" \
19403  "\n" \
19404  " for (j = 0; ((j < givrListInst.iNbr) && (0 == strcmp(tcCodloc, givrListParu.trEltList[k].loc))); j++)\n" \
19405  " {\n" \
19406  " if ((0 != strcmp(\"99\", givrListInst.trEltList[j].arr)) && ((int4)GIV::GIXCodeOK != givrListParu.trEltList[k].iZU))\n" \
19407  " iGeoArrInst = GIV::giv_ARR;\n" \
19408  "\n" \
19409  " if (0 == strcmp(givrListInst.trEltList[j].arr, givrListParu.trEltList[k].arr))\n" \
19410  " break;\n" \
19411  " }\n" \
19412  "\n" \
19413  " if (givrListInst.iNbr != j)\n" \
19414  " {\n" \
19415  " /* même arrondissement */\n" \
19416  " /* inscription locale : arr */\n" \
19417  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
19418  " iGeoArr = GIV::giv_ARR;\n" \
19419  " }\n" \
19420  " else\n" \
19421  " {\n" \
19422  " /* arr inst != arr paru */\n" \
19423  " /* différents arrondissements */\n" \
19424  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
19425  " iGeoArr = GIV::giv_LOC;\n" \
19426  "\n" \
19427  " /* inscription locale : arr extra */\n" \
19428  " }\n" \
19429  " }\n" \
19430  " else\n" \
19431  " {\n" \
19432  " /* inscription départementale */\n" \
19433  " /* loc inst != loc paru */\n" \
19434  " /* différentes localités */\n" \
19435  " iGeoLoc = GIV::giv_DEPT;\n" \
19436  "\n" \
19437  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
19438  " iGeoArr = GIV::giv_DEPT;\n" \
19439  "\n" \
19440  " /* inscription dept : loc extra */\n" \
19441  " }\n" \
19442  " }\n" \
19443  " else\n" \
19444  " {\n" \
19445  " /* inscription extra départementale */\n" \
19446  " iGeoDept = GIV::giv_EXTL;\n" \
19447  " iGeoLoc = GIV::giv_EXTL;\n" \
19448  "\n" \
19449  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
19450  " iGeoArr = GIV::giv_EXTL;\n" \
19451  "\n" \
19452  " /* inscription régionale */\n" \
19453  " }\n" \
19454  " }\n" \
19455  " else\n" \
19456  " {\n" \
19457  " /* différentes régions */\n" \
19458  " /* inscription extra départementale */\n" \
19459  " iGeoDept = GIV::giv_EXTL;\n" \
19460  " iGeoLoc = GIV::giv_EXTL;\n" \
19461  "\n" \
19462  " if (0 != strcmp(\"99\", givrListParu.trEltList[k].arr))\n" \
19463  " iGeoArr = GIV::giv_EXTL;\n" \
19464  "\n" \
19465  " /* inscription extra-régionale */\n" \
19466  " iGeoReg = GIV::giv_EXTL;\n" \
19467  " }\n" \
19468  "\n" \
19469  " /* pas d'arrondissement pour le pôle de zone urbaine */\n" \
19470  " if (0 == strcmp(\"00\", givrListParu.trEltList[k].arr))\n" \
19471  " iGeoArr = 99;\n" \
19472  "\n" \
19473  " if (0 == strcmp(\"999\", givrListParu.trEltList[k].dep))\n" \
19474  " {\n" \
19475  " /* ancienne région : seule la parution sur région est validée */\n" \
19476  " iGeoDept = GIV::giv_DFT;\n" \
19477  " iGeoLoc = GIV::giv_DFT;\n" \
19478  " iGeoArr = GIV::giv_DFT;\n" \
19479  " }\n" \
19480  "\n" \
19481  " /* Validation iGeo */\n" \
19482  " /* changement de reg */\n" \
19483  " givrListParu.trEltList[k].iGeoReg = iGeoReg;\n" \
19484  " /* changement de dept */\n" \
19485  " givrListParu.trEltList[k].iGeoDept = iGeoDept;\n" \
19486  " /* changement de loc */\n" \
19487  " givrListParu.trEltList[k].iGeoLoc = iGeoLoc;\n" \
19488  " /* changement d'arr */\n" \
19489  " givrListParu.trEltList[k].iGeoArr = iGeoArr;\n" \
19490  " }\n" \
19491  "\n" \
19492  " /* changement d'arr instal */\n" \
19493  " for (j = 0; j < givrListInst.iNbr; j++)\n" \
19494  " {\n" \
19495  " if (0 != strcmp(\"99\", givrListInst.trEltList[j].arr))\n" \
19496  " givrListInst.trEltList[j].iGeoArr = iGeoArrInst;\n" \
19497  " }\n" \
19498  "\n" \
19499  " GWTTrace(GWT_NIV_FONCT, (\" Inscription [%s],[%s],[%s],[%s]\\n\", doc->value.inscription[0].cReg, doc->value.inscription[0].cCoddep, doc->value.inscription[0].cCodloc,\n" \
19500  " doc->value.inscription[0].cArrond));\n" \
19501  " GWTTrace(GWT_NIV_FONCT, (\"Parution-Installation Inscription [%d],[%d]\\n\", givrListParu.iNbr, givrListInst.iNbr));\n" \
19502  " /* Retourner sans erreur */\n" \
19503  " return (iCodRet);\n" \
19504  "}\n" \
19505  "\n" \
19506  "/*----Fonction----------------------------------------------------------------*/\n" \
19507  "/* */\n" \
19508  "/* Fonction :giv_close_fichier_sortie () */\n" \
19509  "/* */\n" \
19510  "/* But : Fermeture du fichier de sortie */\n" \
19511  "/* */\n" \
19512  "/* */\n" \
19513  "/* */\n" \
19514  "/* */\n" \
19515  "/* Entree(s) : */\n" \
19516  "/* */\n" \
19517  "/* Sortie(s) : OK ou KO */\n" \
19518  "/* */\n" \
19519  "/* Portable : Transparent */\n" \
19520  "/* */\n" \
19521  "/*----------------------------------------------------------------------------*/\n" \
19522  "static int4 giv_fermeture_fichier_sortie(char** buf_pos_in, char* blocid)\n" \
19523  "{\n" \
19524  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
19525  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
19526  " char* buf_pos;\n" \
19527  " int4 lg_a_ecrire;\n" \
19528  " char tcNumMvt[GXWLgIdDonnees];\n" \
19529  " char* pcVersion = NULL;\n" \
19530  " GWTTrace(GWT_NIV_FONCT, (\"On passe dans l'ecriture du fichier de sortie \\n\"));\n" \
19531  " buf_pos = *buf_pos_in;\n" \
19532  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
19533  " lg_a_ecrire = strlen(GIVBuffTest);\n" \
19534  "\n" \
19535  " if ((0 != lg_a_ecrire) && (NULL != GIVfDescFicMCD) && ((int4)GIV::GIXCodeOK != giviCodRetEcr) && ((int4)GIV::GIXCodeOK == giviEnrich))\n" \
19536  " {\n" \
19537  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur : bloc %s\\n\", blocid));\n" \
19538  " /* Pas d'écriture buffer de cas de test : débordement */\n" \
19539  " GIVBuffTest[0] = '\\0';\n" \
19540  " }\n" \
19541  " else if ((0 != lg_a_ecrire) && (NULL != GIVfDescFicMCD) && ((int4)GIV::GIXCodeOK == giviEnrich))\n" \
19542  " {\n" \
19543  " GWTTrace(GWT_NIV_FONCT, (\"Ecriture de BuffTest %d\\n\", lg_a_ecrire));\n" \
19544  " /* Ecriture buffer de cas de test */\n" \
19545  " iIntRet = (int4)fwrite(GIVBuffTest, lg_a_ecrire, 1, GIVfDescFicMCD);\n" \
19546  " GIVBuffTest[0] = '\\0';\n" \
19547  " }\n" \
19548  "\n" \
19549  " if (((int4)GIV::GIXCodeOK == giviClose) && (NULL != GIVfDescFicMCD))\n" \
19550  " {\n" \
19551  " /* Initialisation pointeur */\n" \
19552  " buf_pos = GIVBuffXML;\n" \
19553  " /* Calcul de la longueur a ecrire */\n" \
19554  " lg_a_ecrire = giv_ecrit_fin_noeud(&buf_pos, \"documents\");\n" \
19555  " /* ecriture de l'enregistrement dans le fichier de sortie */\n" \
19556  " GWTTrace(GWT_NIV_FONCT, (\"Taille du buff a ecrire dans le fic XML : %d\\n\", lg_a_ecrire));\n" \
19557  " /* Ecriture dans le fichier de sortie */\n" \
19558  " iIntRet = (int4)fwrite(GIVBuffXML, lg_a_ecrire, 1, GIVfDescFicMCD);\n" \
19559  " /* fichier rempli */\n" \
19560  " iIntRet = fclose(GIVfDescFicMCD);\n" \
19561  "\n" \
19562  " if (iIntRet != (int4)GIV::GWCCodeOK)\n" \
19563  " {\n" \
19564  " /* probleme de fermeture de fichier */\n" \
19565  " GWTTrace(GWT_NIV_GRAVE, (\"Probleme de fermeture de fichier \\n\"));\n" \
19566  " iCodRet = GIV::GIXCodeKO;\n" \
19567  " }\n" \
19568  "\n" \
19569  " GIVfDescFicMCD = NULL;\n" \
19570  "\n" \
19571  " if (NULL != GIVfDescFicCFLT)\n" \
19572  " {\n" \
19573  " iIntRet = fclose(GIVfDescFicCFLT);\n" \
19574  "\n" \
19575  " if (iIntRet != (int4)GIV::GWCCodeOK)\n" \
19576  " {\n" \
19577  " /* probleme de fermeture de fichier */\n" \
19578  " GWTTrace(GWT_NIV_GRAVE, (\"Probleme de fermeture de fichier \\n\"));\n" \
19579  " iCodRet = GIV::GIXCodeKO;\n" \
19580  " }\n" \
19581  " }\n" \
19582  "\n" \
19583  " GIVfDescFicCFLT = NULL;\n" \
19584  "\n" \
19585  " if (NULL != GIVfDescFicETB)\n" \
19586  " {\n" \
19587  " iIntRet = fclose(GIVfDescFicETB);\n" \
19588  "\n" \
19589  " if (iIntRet != (int4)GIV::GWCCodeOK)\n" \
19590  " {\n" \
19591  " /* probleme de fermeture de fichier */\n" \
19592  " GWTTrace(GWT_NIV_GRAVE, (\"Probleme de fermeture de fichier \\n\"));\n" \
19593  " iCodRet = GIV::GIXCodeKO;\n" \
19594  " }\n" \
19595  " }\n" \
19596  "\n" \
19597  " GIVfDescFicETB = NULL;\n" \
19598  " GIViCommit = (int4)GIV::GIXCodeOK;\n" \
19599  " giviClose = (int4)GIV::GIXCodeKO;\n" \
19600  " /* Effacement du buffer */\n" \
19601  " GIVBuffXML[0] = '\\0';\n" \
19602  "\n" \
19603  " if ((0 == strcmp(givRecreerCD, GIXcNomIntf)) && (0 != strcmp(GIXcValUrg, GWZUrgent)))\n" \
19604  " {\n" \
19605  " /* Construction chaine de marquage reprise */\n" \
19606  " (void)sprintf(tcNumMvt, \"%d-%s\", giviNumFic, nom_bloc_ref);\n" \
19607  " pcVersion = strchr(pcVersionInsFour[0], (char)'.');\n" \
19608  " pcVersion++;\n" \
19609  " GWTTrace(GWT_NIV_FONCT, (\"Bloc reprise [%s]\\n\", tcNumMvt));\n" \
19610  " /* Sauvegarde chaine de version dans referentiel */\n" \
19611  " iIntRet = GHHModiVersionIeinscDest(GIXcDepartement, GIXcNomIntf, pcVersion, (char*)NULL, tcNumMvt, GIXcNomDest);\n" \
19612  "\n" \
19613  " if ((int4)GIV::GWZKo == iIntRet)\n" \
19614  " {\n" \
19615  " /* Erreur mise a jour donnees de version */\n" \
19616  " GWTTrace(GWT_NIV_FONCT, (\"Erreur GHHModiVersionIeinsc ...\\n\"));\n" \
19617  " }\n" \
19618  " }\n" \
19619  " }\n" \
19620  "\n" \
19621  " *buf_pos_in = buf_pos;\n" \
19622  " return (iCodRet);\n" \
19623  "}\n" \
19624  "\n" \
19625  "/*----Fonction----------------------------------------------------------------*/\n" \
19626  "/* */\n" \
19627  "/* Fonction : givInitBlocParution () */\n" \
19628  "/* */\n" \
19629  "/* But : Initialisation de la structure d'un bloc */\n" \
19630  "/* XML a vide, avant réut */\n" \
19631  "/* */\n" \
19632  "/* */\n" \
19633  "/* */\n" \
19634  "/* Entree(s) : la structure XML d'un bloc */\n" \
19635  "/* */\n" \
19636  "/* Sortie(s) : OK ou KO */\n" \
19637  "/* */\n" \
19638  "/* Portable : Transparent */\n" \
19639  "/* */\n" \
19640  "/*----------------------------------------------------------------------------*/\n" \
19641  "\n" \
19642  "static int4 givInitBlocParution(GYBrDOCUMENTEpj* doc)\n" \
19643  "{\n" \
19644  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
19645  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
19646  " /* Effacement de la zone de donnees */\n" \
19647  " memset(doc, 0, sizeof(*doc));\n" \
19648  " giviNbParentPart = 0;\n" \
19649  " return (iCodRet);\n" \
19650  "} /* Fin IniBloc de parution */\n" \
19651  "\n" \
19652  "/*----------------------------------Fonction----------------------------------*\n" \
19653  " * Fonction : givMefPnom\n" \
19654  " *\n" \
19655  " * But : Mise en forme du champ prénom\n" \
19656  " *\n" \
19657  " * Description :\n" \
19658  " * Cette fonction récupère les initilaes du champ prénom de l'inscription\n" \
19659  " *\n" \
19660  " *---------------------------------Historique----------------------------------\n" \
19661  " *\n" \
19662  " * Création : Fev/07/2007 (mb)\n" \
19663  " *\n" \
19664  " * Modification (MMM/JJ/AAAA - xx) :\n" \
19665  " *\n" \
19666  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
19667  "\n" \
19668  "static int4 givMefPnom(char* aprPrenom, char* aprInit)\n" \
19669  "{\n" \
19670  " /* code retour des fonctions appelées */\n" \
19671  " int4 iCodRet = GIV::GWCCodeOK;\n" \
19672  " /* Prénom obtenu dans l'inscription */\n" \
19673  " char* pcPrenom;\n" \
19674  " /* Mot courant du prénom ( spécifique au traitement des initiales ) */\n" \
19675  " char tcMotCrt[128];\n" \
19676  " int4 iLgPrenom, iBoucle;\n" \
19677  " /* Récupération du prénom complet */\n" \
19678  " pcPrenom = aprPrenom;\n" \
19679  " iLgPrenom = 0;\n" \
19680  "\n" \
19681  " /* Parcours de la liste des prénoms */\n" \
19682  " while (1 == sscanf(pcPrenom, \"%s\", tcMotCrt))\n" \
19683  " {\n" \
19684  " GWTTrace(GWT_NIV_FONCT, (\"Mot : %s\\n\", tcMotCrt));\n" \
19685  "\n" \
19686  " /* A la recherche du mot de liaison 'et' qui doit figurer dans la réponse */\n" \
19687  " /* Le blanc séparateur est systématiquement placé avant le mot de liaison */\n" \
19688  " if ((0 == strcmp(\"ET\", tcMotCrt)) || (0 == strcmp(\"et\", tcMotCrt)) || (0 == strcmp(\"Et\", tcMotCrt)))\n" \
19689  " {\n" \
19690  " aprInit[iLgPrenom++] = ' ';\n" \
19691  " memcpy(&aprInit[iLgPrenom], tcMotCrt, strlen(tcMotCrt));\n" \
19692  " iLgPrenom += strlen(tcMotCrt);\n" \
19693  " }\n" \
19694  " else\n" \
19695  " {\n" \
19696  " /* Ou à la recherche de l'initiale qui peut être double dans le cas */\n" \
19697  " /* des prénoms composés ( séparés par un tiret ) */\n" \
19698  " /* Le blanc séparateur est rajouté devant l'initiale sauf s'il */\n" \
19699  " /* s'agit du premier prénom de la liste traîté */\n" \
19700  " /* Par contre les initiales d'un prénom composé sont collées */\n" \
19701  " iLgPrenom = strlen(aprInit);\n" \
19702  "\n" \
19703  " if (0 != iLgPrenom)\n" \
19704  " {\n" \
19705  " aprInit[iLgPrenom] = ' ';\n" \
19706  " iLgPrenom++;\n" \
19707  " }\n" \
19708  "\n" \
19709  " aprInit[iLgPrenom] = tcMotCrt[0];\n" \
19710  " iLgPrenom++;\n" \
19711  "\n" \
19712  " for (iBoucle = 0; iBoucle < strlen(tcMotCrt); iBoucle++)\n" \
19713  " {\n" \
19714  " if ('-' == tcMotCrt[iBoucle])\n" \
19715  " {\n" \
19716  " aprInit[iLgPrenom] = tcMotCrt[iBoucle + 1];\n" \
19717  " iLgPrenom++;\n" \
19718  " }\n" \
19719  " }\n" \
19720  "\n" \
19721  " aprInit[iLgPrenom] = 0;\n" \
19722  " }\n" \
19723  "\n" \
19724  " /* Passage au prénom suivant dans la liste */\n" \
19725  " if (0 != strcmp(pcPrenom, tcMotCrt))\n" \
19726  " pcPrenom += strlen(tcMotCrt) + 1;\n" \
19727  " else\n" \
19728  " break;\n" \
19729  " }\n" \
19730  "\n" \
19731  " /* Retourner sans erreur */\n" \
19732  " return (iCodRet);\n" \
19733  "}\n" \
19734  "\n" \
19735  "/*----Fonction----------------------------------------------------------------*/\n" \
19736  "/* */\n" \
19737  "/* Fonction : givMefDonneesGestion () */\n" \
19738  "/* */\n" \
19739  "/* But : Mise en forme de l'ensemble \"donnees de gestion\" */\n" \
19740  "/* */\n" \
19741  "/* */\n" \
19742  "/* */\n" \
19743  "/* Entree(s) : */\n" \
19744  "/* */\n" \
19745  "/* Sortie(s) : OK ou KO */\n" \
19746  "/* */\n" \
19747  "/* Portable : Transparent */\n" \
19748  "/* */\n" \
19749  "/*----------------------------------------------------------------------------*/\n" \
19750  "\n" \
19751  "static int4 givMefDonneesGestion(GYBrDOCUMENTEpj* doc, int4 indice)\n" \
19752  "{\n" \
19753  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
19754  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
19755  " char* pcFour = NULL;\n" \
19756  " char cBufSeq[sizeof(GIVvInscrip.acNoselo) + 1 + sizeof(GIVvInscrip.acNosels)] = \"\";\n" \
19757  " int4 i;\n" \
19758  " /* initialisation données locales */\n" \
19759  " (void)memset(&cBufSeq[0], 0x00, sizeof(cBufSeq));\n" \
19760  " /* on a qu'une inscription dans doc */\n" \
19761  " indice = 0;\n" \
19762  " /* Encodage du numero national */\n" \
19763  " /* le numéro de téléphone est transmis en clair */\n" \
19764  " (void)strcpy(givcNumnat, cNumnat);\n" \
19765  " strcpy(doc->value.inscription[indice].val_num, givcNumnat);\n" \
19766  " GWTTrace(GWT_NIV_FONCT, (\"No nat : %s\\n\", doc->value.inscription[indice].val_num));\n" \
19767  " /* Encodage du numero de LO */\n" \
19768  " usLgchamp = strlen(cNumlo);\n" \
19769  " /* cas des numlo d'authentification = fournisseur, passer en numérique */\n" \
19770  " pcFour = strstr(GIVcListeFour, cNumlo);\n" \
19771  "\n" \
19772  " if (NULL != pcFour)\n" \
19773  " {\n" \
19774  " /* c'est une inscription d'authentification */\n" \
19775  " (void)sprintf(cNumlo, \"%04d\", ((pcFour - &GIVcListeFour[0]) / (GYBIeinscLgNumlo + 1)) + 1);\n" \
19776  " }\n" \
19777  "\n" \
19778  " /* Encodage du No Lo */\n" \
19779  " strcpy(doc->value.inscription[indice].val_lo, cNumlo);\n" \
19780  " GWTTrace(GWT_NIV_FONCT, (\"No Lo : %s\\n\", doc->value.inscription[indice].val_lo));\n" \
19781  " /* Encodage du numero de LS */\n" \
19782  " strcpy(doc->value.inscription[indice].val_ls, cNumls);\n" \
19783  " GWTTrace(GWT_NIV_FONCT, (\"No Ls : %s\\n\", doc->value.inscription[indice].val_ls));\n" \
19784  " /* nature de l'inscription */\n" \
19785  " doc->cNature = GIVvInscrip.acNature;\n" \
19786  "\n" \
19787  " if (giv_cLEUR == doc->value.inscription[indice].val_num[0])\n" \
19788  " {\n" \
19789  " /* partenaire leurre (origine PJ) */\n" \
19790  " doc->cNature = doc->value.inscription[indice].val_num[0];\n" \
19791  " }\n" \
19792  "\n" \
19793  " /* partenaire */\n" \
19794  " doc->cIndPart = GIVvInscrip.acIndPart[0];\n" \
19795  "\n" \
19796  " /* Encodage du numero de bloc précédent */\n" \
19797  " if (0 == strcmp(cBlocidPrec, \"C0001\"))\n" \
19798  " {\n" \
19799  " /* chgmt 888 vers 999 */\n" \
19800  " strcpy(doc->value.inscription[indice].trace_bloc, \"888-999\");\n" \
19801  " }\n" \
19802  " else if (0 == strcmp(cBlocidPrec, \"C0002\"))\n" \
19803  " {\n" \
19804  " /* chgmt 999 vers 888 */\n" \
19805  " strcpy(doc->value.inscription[indice].trace_bloc, \"999-888\");\n" \
19806  " }\n" \
19807  " else\n" \
19808  " strcpy(doc->value.inscription[indice].trace_bloc, cBlocidPrec);\n" \
19809  "\n" \
19810  " GWTTrace(GWT_NIV_FONCT, (\"No Bloc trace : %s\\n\", doc->value.inscription[indice].trace_bloc));\n" \
19811  " /* Encodage de la clé de tri */\n" \
19812  " strcpy(doc->value.inscription[indice].val_tri1, &GIVvInscrip.acCleTri1[1]);\n" \
19813  " GWTTrace(GWT_NIV_FONCT, (\"Cle tri : %s\\n\", doc->value.inscription[indice].val_tri1));\n" \
19814  " strcpy(doc->value.inscription[indice].val_tri2, &GIVvInscrip.acCleTri2[1]);\n" \
19815  " GWTTrace(GWT_NIV_FONCT, (\"Cle tri : %s\\n\", doc->value.inscription[indice].val_tri2));\n" \
19816  "\n" \
19817  " /* Encodage du numero de regroupement */\n" \
19818  " if ((int4)GIV::GYBok == GIVvIndInscrip.sNogrouI && (boolen != 2))\n" \
19819  " {\n" \
19820  " strcpy(doc->value.inscription[indice].val_grp, GIVvInscrip.acNogrou);\n" \
19821  " GWTTrace(GWT_NIV_FONCT, (\"No grp : %s\\n\", doc->value.inscription[indice].val_grp));\n" \
19822  " }\n" \
19823  " else if (boolen == 2)\n" \
19824  " {\n" \
19825  " strcpy(doc->value.inscription[indice].val_grp, nogrou_sav);\n" \
19826  " GWTTrace(GWT_NIV_FONCT, (\"No grp 2eme choix: %s\\n\", doc->value.inscription[indice].val_grp));\n" \
19827  " }\n" \
19828  "\n" \
19829  " /* Encodage du numero de sequence LO/LS les deux concatenes */\n" \
19830  " if (0 == strcmp(GIVvInscrip.acNumls, \"0000\"))\n" \
19831  " strcpy(doc->value.inscription[indice].val_seq, GIVvInscrip.acNoselo);\n" \
19832  " else\n" \
19833  " {\n" \
19834  " strcpy(&doc->value.inscription[indice].val_seq[1], GIVvInscrip.acNosels);\n" \
19835  " doc->value.inscription[indice].val_seq[0] = '0';\n" \
19836  " }\n" \
19837  "\n" \
19838  " strcpy(doc->value.inscription[indice].val_seqLO, GIVvInscrip.acNoselo);\n" \
19839  " strcpy(doc->value.inscription[indice].val_seqLS, GIVvInscrip.acNosels);\n" \
19840  " GWTTrace(GWT_NIV_FONCT, (\"No seq : %s\\n\", doc->value.inscription[indice].val_seq));\n" \
19841  " strcpy(doc->value.inscription[indice].val_lols, cNumlo);\n" \
19842  " strcpy(doc->value.inscription[indice].val_lslo, cNumls);\n" \
19843  " iCodRet = GIV::GWCCodeOK;\n" \
19844  " /* Sortie de la fonction givMefDonneesGestion*/\n" \
19845  " return (iCodRet);\n" \
19846  "}\n" \
19847  "\n" \
19848  "/*----Fonction----------------------------------------------------------------*/\n" \
19849  "/* */\n" \
19850  "/* Fonction : givMefDonneesParution () */\n" \
19851  "/* */\n" \
19852  "/* But : Mise en forme de l'ensemble \"donnees de parution\" */\n" \
19853  "/* */\n" \
19854  "/* */\n" \
19855  "/* */\n" \
19856  "/* Entree(s) : */\n" \
19857  "/* */\n" \
19858  "/* Sortie(s) : OK ou KO */\n" \
19859  "/* */\n" \
19860  "/* Portable : Transparent */\n" \
19861  "/* */\n" \
19862  "/*----------------------------------------------------------------------------*/\n" \
19863  "/* */\n" \
19864  "/* Modification (Dec/03/2002 mb) : ajout de mention tarifaire */\n" \
19865  "/*----------------------------------------------------------------------------*/\n" \
19866  "\n" \
19867  "static int4 givMefDonneesParution(GYBrDOCUMENTEpj* doc, int4 aIndice)\n" \
19868  "{\n" \
19869  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
19870  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
19871  " /* numéro de client */\n" \
19872  " char givcNumcli[8];\n" \
19873  " int4 i, j, k, lg;\n" \
19874  " int4 iDept, iArrond;\n" \
19875  " int4 iRes, iAcc;\n" \
19876  " int4 indice;\n" \
19877  " GYBrIapartT rPart;\n" \
19878  " /* on a qu'une inscription dans doc */\n" \
19879  " indice = 0;\n" \
19880  " /* indicateur de protection */\n" \
19881  " strcpy(doc->value.intitule.protection, GIVvInscrip.acInprot);\n" \
19882  " /* indicateur de support */\n" \
19883  " strcpy(doc->value.intitule.support, GIVvInscrip.acInsupp);\n" \
19884  "\n" \
19885  " /* Encodage de la designation de ligne */\n" \
19886  " if ((int4)GIV::GYBok == GIVvIndInscrip.sDesignI)\n" \
19887  " {\n" \
19888  " strcpy(doc->value.inscription[indice].moyen_de_com.designation_ligne, GIVvInscrip.acDesign);\n" \
19889  " GWTTrace(GWT_NIV_FONCT, (\"DESIGNATION DE LIGNE : %s\\n\", doc->value.inscription[indice].moyen_de_com.designation_ligne));\n" \
19890  " }\n" \
19891  "\n" \
19892  " /* Encodage du numero de client */\n" \
19893  " if ((int4)GIV::GYBok == GIVvIndInscrip.sNumcliI)\n" \
19894  " {\n" \
19895  " memcpy(&givcNumcli[0], &GIVvInscrip.acNumcli[4], 8);\n" \
19896  " givcNumcli[8] = '\\0';\n" \
19897  " strcpy(doc->value.numero_client, givcNumcli);\n" \
19898  " GWTTrace(GWT_NIV_FONCT, (\"No_CLIENT : %s\\n\", doc->value.numero_client));\n" \
19899  " }\n" \
19900  "\n" \
19901  " /* Encodage du numero du code etablissement */\n" \
19902  " if ((int4)GIV::GYBok == GIVvIndInscrip.sEtabI)\n" \
19903  " {\n" \
19904  " strcpy(doc->value.a_classer.etab_dc, GIVvInscrip.acEtab);\n" \
19905  " strcpy(doc->value.a_classer.etab, GIVvInscrip.acEtab);\n" \
19906  " GWTTrace(GWT_NIV_FONCT, (\"ETAB : %s\\n\", doc->value.a_classer.etab));\n" \
19907  " }\n" \
19908  "\n" \
19909  " /* Encodage du numero de code SIRET */\n" \
19910  " if ((int4)GIV::GYBok == GIVvIndInscrip.sSiretI)\n" \
19911  " {\n" \
19912  " strcpy(doc->value.a_classer.siret, GIVvInscrip.acSiret);\n" \
19913  " GWTTrace(GWT_NIV_FONCT, (\"SIRET : %s\\n\", doc->value.a_classer.siret));\n" \
19914  " }\n" \
19915  "\n" \
19916  " /* Encodage du numero du code NAF */\n" \
19917  " if ((int4)GIV::GYBok == GIVvIndInscrip.sNafI)\n" \
19918  " {\n" \
19919  " for (i = 0; i < (strlen(GIVvInscrip.acNaf) - 1); i++)\n" \
19920  " {\n" \
19921  " if (0 == isdigit(GIVvInscrip.acNaf[i]))\n" \
19922  " break;\n" \
19923  " }\n" \
19924  "\n" \
19925  " if ((i != (strlen(GIVvInscrip.acNaf) - 1)) || ('A' > GIVvInscrip.acNaf[strlen(GIVvInscrip.acNaf) - 1]) || ('Z' < GIVvInscrip.acNaf[strlen(GIVvInscrip.acNaf) - 1]))\n" \
19926  " strcpy(doc->value.a_classer.naf, \"\");\n" \
19927  " else\n" \
19928  " strcpy(doc->value.a_classer.naf, GIVvInscrip.acNaf);\n" \
19929  "\n" \
19930  " GWTTrace(GWT_NIV_FONCT, (\"NAF : %s\\n\", doc->value.a_classer.naf));\n" \
19931  " }\n" \
19932  "\n" \
19933  " GWTTrace(GWT_NIV_FONCT, (\"Nb IaPart : %d\\n\", GIViNbTupleIapart));\n" \
19934  "\n" \
19935  " if (0 != GIViNbTupleIapart)\n" \
19936  " {\n" \
19937  " iRes = 0;\n" \
19938  " iAcc = 0;\n" \
19939  "\n" \
19940  " for (i = 0; i < GIViNbTupleIapart; i++)\n" \
19941  " {\n" \
19942  " if ((0 == strcmp(GIVtrPart[i].acOriPart, giv_RESA)) && (NULL == strstr(givtcFourPart, GIVtrPart[i].acOriPart)))\n" \
19943  " iRes = 1;\n" \
19944  " else if ((0 == strcmp(GIVtrPart[i].acOriPart, giv_ACCO)) && (NULL == strstr(givtcFourPart, GIVtrPart[i].acOriPart)))\n" \
19945  " {\n" \
19946  " iAcc = 1;\n" \
19947  " break;\n" \
19948  " }\n" \
19949  " }\n" \
19950  "\n" \
19951  " j = 0;\n" \
19952  "\n" \
19953  " for (i = 0; i < GIViNbTupleIapart; i++)\n" \
19954  " {\n" \
19955  " if ((NULL == strstr(givtcFourPart, GIVtrPart[i].acOriPart)) || ('0' != GIVvInscrip.acIndPart[0]))\n" \
19956  " {\n" \
19957  " if ((1 == iAcc) && GIVtrPart[i].isOriginePartenaires(giv_RESA, giv_EXPD))\n" \
19958  " {\n" \
19959  " GWTTrace(GWT_NIV_FONCT, (\"Part resa/expd non prioritaire : %s, %s\\n\", GIVtrPart[i].acRefPart, doc->value.a_classer.etab));\n" \
19960  " continue;\n" \
19961  " }\n" \
19962  " else if ((1 == iRes) && (0 == strcmp(GIVtrPart[i].acOriPart, giv_EXPD)))\n" \
19963  " {\n" \
19964  " GWTTrace(GWT_NIV_FONCT, (\"Part expd non prioritaire : %s, %s\\n\", GIVtrPart[i].acRefPart, doc->value.a_classer.etab));\n" \
19965  " continue;\n" \
19966  " }\n" \
19967  " else if (0 == strcmp(GIVtrPart[i].acOriPart, rPart.acOriPart))\n" \
19968  " {\n" \
19969  " GWTTrace(GWT_NIV_FONCT, (\"Part expd double non prioritaire : %s, %s\\n\", GIVtrPart[i].acRefPart, doc->value.a_classer.etab));\n" \
19970  " continue;\n" \
19971  " }\n" \
19972  "\n" \
19973  " strcpy(rPart.acOriPart, GIVtrPart[i].acOriPart);\n" \
19974  " doc->value.a_classer.trpart[j].iForPJDC = GIV::GIXCodeKO;\n" \
19975  " strcpy(doc->value.a_classer.trpart[j].rpart, GIVtrPart[i].acRefPart);\n" \
19976  " strcat(doc->value.a_classer.trpart[j].rpart, GIVtrPart[i].acOriPart);\n" \
19977  " strcpy(doc->value.a_classer.trpart[j].parent, GIVtrPart[i].acParentRefPart);\n" \
19978  "\n" \
19979  " for (k = 0; (k < givNbPart && (0 != strcmp(GIVtrPart[i].acOriPart, givTabPart[k].tcPart))); k++)\n" \
19980  " ;\n" \
19981  "\n" \
19982  " if (givNbPart == k)\n" \
19983  " doc->value.a_classer.trpart[j].prod[0] = '\\0';\n" \
19984  " else\n" \
19985  " strcpy(doc->value.a_classer.trpart[j].prod, givTabPart[k].tcProd);\n" \
19986  "\n" \
19987  " GWTTrace(GWT_NIV_FONCT, (\"Part : %s,%s\\n\", doc->value.a_classer.trpart[j].rpart, doc->value.a_classer.trpart[j].prod));\n" \
19988  " j++;\n" \
19989  " }\n" \
19990  " }\n" \
19991  "\n" \
19992  " GIViNbTupleIapart = j;\n" \
19993  " }\n" \
19994  "\n" \
19995  " doc->value.a_classer.iNbPart = GIViNbTupleIapart;\n" \
19996  "\n" \
19997  " /* Encodage du titre de civilite */\n" \
19998  " if ((int4)GIV::GYBok != GIVvIndInscrip.sCivilI)\n" \
19999  " {\n" \
20000  " /* valeur par defaut : pas de titre de civilité */\n" \
20001  " (void)strcpy(GIVvInscrip.acCivil, \" \");\n" \
20002  " }\n" \
20003  "\n" \
20004  " (void)strcpy(doc->value.intitule.civilite, GIVvInscrip.acCivil);\n" \
20005  " GWTTrace(GWT_NIV_FONCT, (\"CIVILITE : %s\\n\", doc->value.intitule.civilite));\n" \
20006  "\n" \
20007  " /* Encodage de la denomination */\n" \
20008  " if ((int4)GIV::GYBok == GIVvIndInscrip.sDenomI)\n" \
20009  " {\n" \
20010  " strcpy(doc->value.intitule.denomination, GIVvInscrip.acDenom);\n" \
20011  " GWTTrace(GWT_NIV_FONCT, (\"DENOMINATION : %s\\n\", doc->value.intitule.denomination));\n" \
20012  " }\n" \
20013  "\n" \
20014  " /* Encodage du complement de denomination */\n" \
20015  " if ((int4)GIV::GYBok == GIVvIndInscrip.sComplnI)\n" \
20016  " {\n" \
20017  " strcpy(doc->value.intitule.complement_denomination, GIVvInscrip.acCompln);\n" \
20018  " GWTTrace(GWT_NIV_FONCT, (\"COMP_DENOMINATION : %s\\n\", doc->value.intitule.complement_denomination));\n" \
20019  " }\n" \
20020  "\n" \
20021  " /* Encodage du sigle */\n" \
20022  " if ((int4)GIV::GYBok == GIVvIndInscrip.sSigleI)\n" \
20023  " {\n" \
20024  " strcpy(doc->value.intitule.sigle, GIVvInscrip.acSigle);\n" \
20025  " GWTTrace(GWT_NIV_FONCT, (\"SIGLE : %s\\n\", doc->value.intitule.sigle));\n" \
20026  " }\n" \
20027  "\n" \
20028  " /* Encodage des mots determinants */\n" \
20029  " if ((int4)GIV::GYBok == GIVvIndInscrip.sMotdetI)\n" \
20030  " {\n" \
20031  " strcpy(doc->value.intitule.mots_determinants, GIVvInscrip.acMotdet);\n" \
20032  " GWTTrace(GWT_NIV_FONCT, (\"MOTDET : %s\\n\", doc->value.intitule.mots_determinants));\n" \
20033  " }\n" \
20034  "\n" \
20035  " /* Obtention de la longueur du champ \"mots_determinants\" */\n" \
20036  " lg = strlen(doc->value.intitule.mots_determinants);\n" \
20037  "\n" \
20038  " /* Dans le cas où il y a un contenu, il faut retirer les caractères \"<\" éventuellement présents à la fin */\n" \
20039  " /* Il s'agit de la règle : Reg_Sel_3 */\n" \
20040  " if (lg > 0)\n" \
20041  " {\n" \
20042  " for (i = lg - 1; i >= 0; i--)\n" \
20043  " {\n" \
20044  " if (doc->value.intitule.mots_determinants[i] == '<')\n" \
20045  " doc->value.intitule.mots_determinants[i] = 0x00;\n" \
20046  " else\n" \
20047  " break;\n" \
20048  " }\n" \
20049  " }\n" \
20050  "\n" \
20051  " /* Fin de règle : Reg_Sel_3 */\n" \
20052  "\n" \
20053  " /* Encodage du prenom */\n" \
20054  " if ((int4)GIV::GYBok == GIVvIndInscrip.sPrenomI)\n" \
20055  " {\n" \
20056  " memset(buf_concat, 0, sizeof(buf_concat));\n" \
20057  " iIntRet = givMefPnom(GIVvInscrip.acPrenom, buf_concat);\n" \
20058  "\n" \
20059  " if (givcParuIPre != GIVvInscrip.acInparu[givcIndInitPre])\n" \
20060  " strcpy(doc->value.intitule.prenom, GIVvInscrip.acPrenom);\n" \
20061  " else\n" \
20062  " strcpy(doc->value.intitule.prenom, buf_concat);\n" \
20063  "\n" \
20064  " GWTTrace(GWT_NIV_FONCT, (\"PRENOM : %s\\n\", doc->value.intitule.prenom));\n" \
20065  " strcpy(doc->value.intitule.initiale, buf_concat);\n" \
20066  " GWTTrace(GWT_NIV_FONCT, (\"INITIALE : %s\\n\", doc->value.intitule.initiale));\n" \
20067  " }\n" \
20068  "\n" \
20069  " /* Date de fin de parution */\n" \
20070  " if ((int4)GIV::GYBok == GIVvIndInscrip.sDateFinParutI)\n" \
20071  " {\n" \
20072  " memcpy(&doc->value.intitule.datefinparu[0], &GIVvInscrip.acDateFinParut[0], 2);\n" \
20073  " doc->value.intitule.datefinparu[2] = '/';\n" \
20074  " memcpy(&doc->value.intitule.datefinparu[3], &GIVvInscrip.acDateFinParut[2], 2);\n" \
20075  " doc->value.intitule.datefinparu[5] = '/';\n" \
20076  " memcpy(&doc->value.intitule.datefinparu[6], &GIVvInscrip.acDateFinParut[4], 4);\n" \
20077  " }\n" \
20078  "\n" \
20079  " if ((int4)GIV::GYBok == GIVvIndInscrip.sMenDomI)\n" \
20080  " {\n" \
20081  " strcpy(doc->value.rubriques.mendom, GIVvInscrip.acMenDom);\n" \
20082  " GWTTrace(GWT_NIV_FONCT, (\"MenDom : ... %s\\n\", doc->value.rubriques.mendom));\n" \
20083  " }\n" \
20084  "\n" \
20085  " if ((int4)GIV::GYBok == GIVvIndInscrip.sMentionI)\n" \
20086  " {\n" \
20087  " strcpy(doc->value.intitule.mention, GIVvInscrip.acMention);\n" \
20088  " GWTTrace(GWT_NIV_FONCT, (\"Mention : ... %s\\n\", doc->value.intitule.mention));\n" \
20089  " }\n" \
20090  "\n" \
20091  " if (((int4)GIV::GYBok == GIVvIndInscrip.sDepActI) && ((int4)GIV::GYBok == GIVvIndInscrip.sLocActI))\n" \
20092  " {\n" \
20093  " strcpy(doc->value.rubriques.depact, GIVvInscrip.acDepAct);\n" \
20094  " GWTTrace(GWT_NIV_FONCT, (\"DepAct : ... %s\\n\", doc->value.rubriques.depact));\n" \
20095  " strcpy(doc->value.rubriques.locact, GIVvInscrip.acLocAct);\n" \
20096  " GWTTrace(GWT_NIV_FONCT, (\"LocAct : ... %s\\n\", doc->value.rubriques.locact));\n" \
20097  " strcpy(doc->value.rubriques.arract, \"\");\n" \
20098  " iDept = atoi(GIVvInscrip.acDepAct);\n" \
20099  "\n" \
20100  " switch (iDept)\n" \
20101  " {\n" \
20102  " case (int4)75:\n" \
20103  " {\n" \
20104  " if (0 == memcmp(&GIVvInscrip.acLocAct[0], \"056\", (int4)3))\n" \
20105  " {\n" \
20106  " /* Paris */\n" \
20107  " iArrond = atoi(&GIVvInscrip.acLocAct[3]);\n" \
20108  "\n" \
20109  " if (((int4)1 <= iArrond) && ((int4)20 >= iArrond))\n" \
20110  " {\n" \
20111  " strcpy(doc->value.rubriques.arract, &GIVvInscrip.acLocAct[3]);\n" \
20112  " strcpy(&doc->value.rubriques.locact[3], \"00\");\n" \
20113  " }\n" \
20114  " }\n" \
20115  "\n" \
20116  " break;\n" \
20117  " }\n" \
20118  "\n" \
20119  " case (int4)69:\n" \
20120  " {\n" \
20121  " if (0 == memcmp(&GIVvInscrip.acLocAct[0], \"123\", (int4)3))\n" \
20122  " {\n" \
20123  " /* Lyon */\n" \
20124  " iArrond = atoi(&GIVvInscrip.acLocAct[3]);\n" \
20125  "\n" \
20126  " if (((int4)1 <= iArrond) && ((int4)9 >= iArrond))\n" \
20127  " {\n" \
20128  " strcpy(doc->value.rubriques.arract, &GIVvInscrip.acLocAct[3]);\n" \
20129  " strcpy(&doc->value.rubriques.locact[3], \"00\");\n" \
20130  " }\n" \
20131  " }\n" \
20132  "\n" \
20133  " break;\n" \
20134  " }\n" \
20135  "\n" \
20136  " case (int4)13:\n" \
20137  " {\n" \
20138  " if (0 == memcmp(&GIVvInscrip.acLocAct[0], \"055\", (int4)3))\n" \
20139  " {\n" \
20140  " /* Marseille */\n" \
20141  " iArrond = atoi(&GIVvInscrip.acLocAct[3]);\n" \
20142  "\n" \
20143  " if (((int4)1 <= iArrond) && ((int4)16 >= iArrond))\n" \
20144  " {\n" \
20145  " strcpy(doc->value.rubriques.arract, &GIVvInscrip.acLocAct[3]);\n" \
20146  " strcpy(&doc->value.rubriques.locact[3], \"00\");\n" \
20147  " }\n" \
20148  " }\n" \
20149  "\n" \
20150  " break;\n" \
20151  " }\n" \
20152  "\n" \
20153  " default:\n" \
20154  " {\n" \
20155  " /* Pas d'arrondissement */\n" \
20156  " strcpy(doc->value.rubriques.arract, \"\");\n" \
20157  " break;\n" \
20158  " }\n" \
20159  " }\n" \
20160  " }\n" \
20161  "\n" \
20162  " /* Encodage du compte utilisateur */\n" \
20163  " if ((int4)GIV::GYBok == GIVvIndInscrip.sCteUtilI)\n" \
20164  " {\n" \
20165  " strcpy(doc->value.inscription[indice].moyen_de_com.cteutil, GIVvInscrip.acCteUtil);\n" \
20166  " GWTTrace(GWT_NIV_FONCT, (\"CteUtil : %s\\n\", doc->value.inscription[indice].moyen_de_com.cteutil));\n" \
20167  " }\n" \
20168  "\n" \
20169  " /* Encodage du nom supplémentaire */\n" \
20170  " if ((int4)GIV::GYBok == GIVvIndInscrip.sNomSuppI)\n" \
20171  " {\n" \
20172  " strcpy(doc->value.inscription[indice].moyen_de_com.nomsupplement, GIVvInscrip.acNomSupp);\n" \
20173  " GWTTrace(GWT_NIV_FONCT, (\"Nom Supplémentaire : %s\\n\", doc->value.inscription[indice].moyen_de_com.nomsupplement));\n" \
20174  " }\n" \
20175  "\n" \
20176  " /* Encodage du masque numnat */\n" \
20177  " if ((int4)GIV::GYBok == GIVvIndInscrip.sMskNumI)\n" \
20178  " {\n" \
20179  " strcpy(doc->value.inscription[indice].moyen_de_com.msknum, GIVvInscrip.acMskNum);\n" \
20180  " GWTTrace(GWT_NIV_FONCT, (\"MskNum : %s\\n\", doc->value.inscription[indice].moyen_de_com.msknum));\n" \
20181  " }\n" \
20182  "\n" \
20183  " /* Encodage du masque mel */\n" \
20184  " if ((int4)GIV::GYBok == GIVvIndInscrip.sMskMelI)\n" \
20185  " {\n" \
20186  " strcpy(doc->value.inscription[indice].moyen_de_com.mskmel, GIVvInscrip.acMskMel);\n" \
20187  " GWTTrace(GWT_NIV_FONCT, (\"MskMel : %s\\n\", doc->value.inscription[indice].moyen_de_com.mskmel));\n" \
20188  " }\n" \
20189  "\n" \
20190  " /* Encodage de la date de maj CU */\n" \
20191  " if ((int4)GIV::GYBok == GIVvIndInscrip.sDatCUI)\n" \
20192  " {\n" \
20193  " strcpy(doc->value.inscription[indice].moyen_de_com.datcu, GIVvInscrip.acDatCU);\n" \
20194  " GWTTrace(GWT_NIV_FONCT, (\"MskMel : %s\\n\", doc->value.inscription[indice].moyen_de_com.datcu));\n" \
20195  " }\n" \
20196  "\n" \
20197  " return (iCodRet);\n" \
20198  "}\n" \
20199  "\n" \
20200  "/*----Fonction----------------------------------------------------------------*/\n" \
20201  "/* */\n" \
20202  "/* Fonction : givMefMoyensTelecom () */\n" \
20203  "/* */\n" \
20204  "/* But : Mise en forme de l'ensemble \"moyens de telecommunication\" */\n" \
20205  "/* */\n" \
20206  "/* */\n" \
20207  "/* */\n" \
20208  "/* Entree(s) : */\n" \
20209  "/* */\n" \
20210  "/* Sortie(s) : OK ou KO */\n" \
20211  "/* */\n" \
20212  "/* Portable : Transparent */\n" \
20213  "/* */\n" \
20214  "/*----------------------------------------------------------------------------*/\n" \
20215  "/* */\n" \
20216  "/* Modification (Nov/13/1997 lgu) : V2 ajout adresse e-mail */\n" \
20217  "/* Modification (Fev/03/1998 lgu) : Adresse internet dans numero d'appel */\n" \
20218  "/* */\n" \
20219  "/*----------------------------------------------------------------------------*/\n" \
20220  "\n" \
20221  "static int4 givMefMoyensTelecom(GYBrDOCUMENTEpj* doc, int4 indice)\n" \
20222  "{\n" \
20223  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
20224  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
20225  " nat1 ucCompteur, ucCptTmp;\n" \
20226  " int1 cDrapeauNumap = (int1)GIV::GWCCodeKO;\n" \
20227  " /* on a qu'une inscription dans doc */\n" \
20228  " indice = 0;\n" \
20229  "\n" \
20230  " /* Encodage du code produit */\n" \
20231  " if ((int4)GIV::GYBok == GIVvIndInscrip.sCodproI)\n" \
20232  " {\n" \
20233  " strcpy(doc->value.inscription[indice].moyen_de_com.code_produit, GIVvInscrip.acCodpro);\n" \
20234  " GWTTrace(GWT_NIV_FONCT, (\"CODE_PRODUIT : %s\\n\", doc->value.inscription[indice].moyen_de_com.code_produit));\n" \
20235  " }\n" \
20236  "\n" \
20237  " /* Encodage du code produit étendu*/\n" \
20238  " if ((int4)GIV::GYBok == GIVvIndInscrip.sCodproEtenduI)\n" \
20239  " {\n" \
20240  " strcpy(doc->value.inscription[indice].moyen_de_com.code_produit_etd, GIVvInscrip.acCodproEtendu);\n" \
20241  " GWTTrace(GWT_NIV_FONCT, (\"CODE_PRODUIT_ETD : %s\\n\", doc->value.inscription[indice].moyen_de_com.code_produit_etd));\n" \
20242  " }\n" \
20243  "\n" \
20244  " /* groupe des données associées au produit lui même */\n" \
20245  " /**-------------------------------------------------*/\n" \
20246  " /* Encodage du numero */\n" \
20247  " strcpy(doc->value.inscription[indice].moyen_de_com.numero, GIVvInscrip.acNumnat);\n" \
20248  " GWTTrace(GWT_NIV_FONCT, (\"NUMERO : %s\\n\", doc->value.inscription[indice].moyen_de_com.numero));\n" \
20249  "\n" \
20250  " /* numap pour monaco */\n" \
20251  " if ((!strcmp(GIVvInscrip.acCoddep, giv_DEP_MONACO) && !strcmp(GIVvInscrip.acCodloc, giv_LOC_MONACO)) || (!strcmp(GIVvInscrip.acDeppar, giv_DEP_MONACO) && !strcmp(GIVvInscrip.acLocpar, giv_LOC_MONACO)\n" \
20252  " && (0 == strcmp(\"0000\", GIVvInscrip.acNumls))))\n" \
20253  " {\n" \
20254  " GWTTrace(GWT_NIV_FONCT, (\"traitement particulier monaco pour numap\\n\"));\n" \
20255  " cDrapeauNumap = (int1)GIV::GWCCodeKO;\n" \
20256  "\n" \
20257  " /* Encodage du numero d'appel du produit */\n" \
20258  " if ((GIVvInscrip.acNumnat[0] == '0') && ((GIVvInscrip.acNumnat[1] == '6') || (GIVvInscrip.acNumnat[1] == '8') || (GIVvInscrip.acNumnat[1] == '9')))\n" \
20259  " {\n" \
20260  " if ((int4)GIV::GYBok == GIVvIndInscrip.sNumapI)\n" \
20261  " {\n" \
20262  " /* Numap present on envoi telquel */\n" \
20263  " strcpy(givcNumnat, GIVvInscrip.acNumap);\n" \
20264  " cDrapeauNumap = (int1)GIV::GWCCodeOK;\n" \
20265  " }\n" \
20266  " }\n" \
20267  " else\n" \
20268  " {\n" \
20269  " if ((int4)GIV::GYBok == GIVvIndInscrip.sNumapI)\n" \
20270  " {\n" \
20271  " /* Numap present */\n" \
20272  " ucCompteur = 0;\n" \
20273  "\n" \
20274  " for (ucCptTmp = 0; ucCptTmp < strlen(GIVvInscrip.acNumap); ucCptTmp++)\n" \
20275  " {\n" \
20276  " if ((GIVvInscrip.acNumap[ucCptTmp] >= '0') && (GIVvInscrip.acNumap[ucCptTmp] <= '9'))\n" \
20277  " ucCompteur++;\n" \
20278  " }\n" \
20279  "\n" \
20280  " if (ucCompteur == 10)\n" \
20281  " {\n" \
20282  " /* on met au format « 00 377 » + un espace + les 8 derniers\n" \
20283  " chiffres du Numap en conservant leur mise en forme */\n" \
20284  " ucCompteur = 0;\n" \
20285  "\n" \
20286  " for (ucCptTmp = strlen(GIVvInscrip.acNumap) - 1; (int1)ucCptTmp >= 0; ucCptTmp--)\n" \
20287  " {\n" \
20288  " if ((GIVvInscrip.acNumap[ucCptTmp] >= '0') && (GIVvInscrip.acNumap[ucCptTmp] <= '9'))\n" \
20289  " ucCompteur++;\n" \
20290  "\n" \
20291  " if (ucCompteur == 8)\n" \
20292  " break;\n" \
20293  " }\n" \
20294  "\n" \
20295  " sprintf(givcNumnat, \"00 377 %s\", GIVvInscrip.acNumap + ucCptTmp);\n" \
20296  " cDrapeauNumap = (int1)GIV::GWCCodeOK;\n" \
20297  " }\n" \
20298  " else\n" \
20299  " {\n" \
20300  " /* on transmet le numap telquel. */\n" \
20301  " strcpy(givcNumnat, GIVvInscrip.acNumap);\n" \
20302  " cDrapeauNumap = (int1)GIV::GWCCodeOK;\n" \
20303  " }\n" \
20304  " }\n" \
20305  " else if ('0' == GIVvInscrip.acIndPart[0])\n" \
20306  " {\n" \
20307  " /* Numap absent -> on met au format '00 377 XX XX XX XX' */\n" \
20308  " sprintf(givcNumnat, \"00 377 %c%c %c%c %c%c %c%c\", GIVvInscrip.acNumnat[2], GIVvInscrip.acNumnat[3], GIVvInscrip.acNumnat[4], GIVvInscrip.acNumnat[5], GIVvInscrip.acNumnat[6], GIVvInscrip.acNumnat[7],\n" \
20309  " GIVvInscrip.acNumnat[8], GIVvInscrip.acNumnat[9]);\n" \
20310  " cDrapeauNumap = (int1)GIV::GWCCodeOK;\n" \
20311  " }\n" \
20312  " }\n" \
20313  "\n" \
20314  " if (cDrapeauNumap == GIV::GWCCodeOK)\n" \
20315  " {\n" \
20316  " strcpy(doc->value.inscription[indice].moyen_de_com.numero_parution, givcNumnat);\n" \
20317  " GWTTrace(GWT_NIV_FONCT, (\"NUMERO_PARUTION : %s\\n\", doc->value.inscription[indice].moyen_de_com.numero_parution));\n" \
20318  " }\n" \
20319  " }\n" \
20320  " else\n" \
20321  " {\n" \
20322  " /* Encodage du numero parution */\n" \
20323  " if ((int4)GIV::GYBok == GIVvIndInscrip.sNumapI)\n" \
20324  " {\n" \
20325  " (void)strcpy(givcNumnat, GIVvInscrip.acNumap);\n" \
20326  "\n" \
20327  " if (((int4)GIV::GYBok == GIVvIndInscrip.sCoddepI) && (0 == memcmp(GIVvInscrip.acCoddep, givcDepPays, strlen(GIVvInscrip.acCoddep))))\n" \
20328  " {\n" \
20329  " /* recherche de l'indicatif du pays */\n" \
20330  " iIntRet = GIVLectureTabPAYS(GIVvInscrip.acCoddep, GIVvInscrip.acCodloc);\n" \
20331  "\n" \
20332  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
20333  " {\n" \
20334  " /* concaténation de l'indicatif avec le numap */\n" \
20335  " (void)sprintf(givcNumnat, \"00 %s %s\", GIVvPays.acIndpays, GIVvInscrip.acNumap);\n" \
20336  " }\n" \
20337  " }\n" \
20338  "\n" \
20339  " strcpy(doc->value.inscription[indice].moyen_de_com.numero_parution, givcNumnat);\n" \
20340  " GWTTrace(GWT_NIV_FONCT, (\"NUMERO_PARUTION : %s\\n\", doc->value.inscription[indice].moyen_de_com.numero_parution));\n" \
20341  " }\n" \
20342  " else if ('0' == GIVvInscrip.acIndPart[0])\n" \
20343  " {\n" \
20344  " if (((int4)GIV::GYBok == GIVvIndInscrip.sCoddepI) && (0 == memcmp(GIVvInscrip.acCoddep, givcDepPays, strlen(GIVvInscrip.acCoddep))))\n" \
20345  " {\n" \
20346  " (void)sprintf(givcNumnat, \"%c%c %c%c %c%c %c%c %c%c\", GIVvInscrip.acNumnat[0], GIVvInscrip.acNumnat[1], GIVvInscrip.acNumnat[2], GIVvInscrip.acNumnat[3], GIVvInscrip.acNumnat[4],\n" \
20347  " GIVvInscrip.acNumnat[5], GIVvInscrip.acNumnat[6], GIVvInscrip.acNumnat[7], GIVvInscrip.acNumnat[8], GIVvInscrip.acNumnat[9]);\n" \
20348  " /* recherche de l'indicatif du pays */\n" \
20349  " iIntRet = GIVLectureTabPAYS(GIVvInscrip.acCoddep, GIVvInscrip.acCodloc);\n" \
20350  "\n" \
20351  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
20352  " {\n" \
20353  " /* concatination de l'indicatif avec le numnat */\n" \
20354  " (void)sprintf(givcNumnat, \"00 %s %c%c %c%c %c%c %c%c %c%c\", GIVvPays.acIndpays, GIVvInscrip.acNumnat[0], GIVvInscrip.acNumnat[1], GIVvInscrip.acNumnat[2], GIVvInscrip.acNumnat[3],\n" \
20355  " GIVvInscrip.acNumnat[4], GIVvInscrip.acNumnat[5], GIVvInscrip.acNumnat[6], GIVvInscrip.acNumnat[7], GIVvInscrip.acNumnat[8], GIVvInscrip.acNumnat[9]);\n" \
20356  " }\n" \
20357  "\n" \
20358  " strcpy(doc->value.inscription[indice].moyen_de_com.numero_parution, givcNumnat);\n" \
20359  " GWTTrace(GWT_NIV_FONCT, (\"NUMERO_PARUTION : %s\\n\", doc->value.inscription[indice].moyen_de_com.numero_parution));\n" \
20360  " }\n" \
20361  " }\n" \
20362  " }\n" \
20363  "\n" \
20364  " /* Encodage du mnemonique (telex ou teletel) */\n" \
20365  " if ((int4)GIV::GYBok == GIVvIndInscrip.sMnemonI)\n" \
20366  " {\n" \
20367  " strcpy(doc->value.inscription[indice].moyen_de_com.mnemonique, GIVvInscrip.acMnemon);\n" \
20368  " GWTTrace(GWT_NIV_FONCT, (\"MNEMONIC : %s\\n\", doc->value.inscription[indice].moyen_de_com.mnemonique));\n" \
20369  " }\n" \
20370  "\n" \
20371  " /* Encodage du libellé d'url */\n" \
20372  " if ((int4)GIV::GYBok == GIVvIndInscrip.sLibUrlI)\n" \
20373  " {\n" \
20374  " strcpy(doc->value.inscription[indice].moyen_de_com.url, GIVvInscrip.acLibUrl);\n" \
20375  " GWTTrace(GWT_NIV_FONCT, (\"URL : %s\\n\", doc->value.inscription[indice].moyen_de_com.url));\n" \
20376  " }\n" \
20377  "\n" \
20378  " if ((int4)GIV::GYBok == GIVvIndInscrip.sIpaysI)\n" \
20379  " {\n" \
20380  " /* Encodage de l'indicatif du pays */\n" \
20381  " strcpy(doc->value.inscription[indice].adresse.ipays, GIVvInscrip.acIpays);\n" \
20382  " GWTTrace(GWT_NIV_FONCT, (\"IPAYS : %s\\n\", doc->value.inscription[indice].adresse.ipays));\n" \
20383  " }\n" \
20384  "\n" \
20385  " /* groupe des données associées à la dénumérotation */\n" \
20386  " /**-------------------------------------------------*/\n" \
20387  "\n" \
20388  " /* Encodage de l'adresse e-mail */\n" \
20389  " if ((int4)GIV::GYBok == GIVvIndInscrip.sEmailI)\n" \
20390  " {\n" \
20391  " strcpy(doc->value.inscription[indice].moyen_de_com.email, GIVvInscrip.acEmail);\n" \
20392  " GWTTrace(GWT_NIV_FONCT, (\"EMAIL : %s\\n\", doc->value.inscription[indice].moyen_de_com.email));\n" \
20393  " }\n" \
20394  "\n" \
20395  " /* Encodage du tiliphone mobile */\n" \
20396  " if ((int4)GIV::GYBok == GIVvIndInscrip.sEquitelI)\n" \
20397  " {\n" \
20398  " strcpy(doc->value.inscription[indice].moyen_de_com.equiptel, GIVvInscrip.acEquitel);\n" \
20399  " GWTTrace(GWT_NIV_FONCT, (\"EQUIPTEL : %s\\n\", doc->value.inscription[indice].moyen_de_com.equiptel));\n" \
20400  " }\n" \
20401  "\n" \
20402  " /* Encodage du tiliphone mobile */\n" \
20403  " if ((int4)GIV::GYBok == GIVvIndInscrip.sServtelI)\n" \
20404  " {\n" \
20405  " strcpy(doc->value.inscription[indice].moyen_de_com.servtel, GIVvInscrip.acServtel);\n" \
20406  " GWTTrace(GWT_NIV_FONCT, (\"SERVTEL : %s\\n\", doc->value.inscription[indice].moyen_de_com.servtel));\n" \
20407  " }\n" \
20408  "\n" \
20409  " /* Encodage du tiliphone mobile */\n" \
20410  " if ((int4)GIV::GYBok == GIVvIndInscrip.sTarifartI)\n" \
20411  " {\n" \
20412  " strcpy(doc->value.inscription[indice].moyen_de_com.tarifart, GIVvInscrip.acTarifart);\n" \
20413  " GWTTrace(GWT_NIV_FONCT, (\"TARIFART : %s\\n\", doc->value.inscription[indice].moyen_de_com.tarifart));\n" \
20414  " }\n" \
20415  "\n" \
20416  " /* Encodage du tiliphone mobile */\n" \
20417  " if ((int4)GIV::GYBok == GIVvIndInscrip.sOpeartI)\n" \
20418  " {\n" \
20419  " strcpy(doc->value.inscription[indice].moyen_de_com.operateur, GIVvInscrip.acOpeart);\n" \
20420  " GWTTrace(GWT_NIV_FONCT, (\"OPERATEUR : %s\\n\", doc->value.inscription[indice].moyen_de_com.operateur));\n" \
20421  " }\n" \
20422  "\n" \
20423  " if ((int4)GIV::GYBok == GIVvIndInscrip.sNumRGI)\n" \
20424  " {\n" \
20425  " strcpy(doc->value.inscription[indice].moyen_de_com.numrg, GIVvInscrip.acNumRG);\n" \
20426  " GWTTrace(GWT_NIV_FONCT, (\"NUMRG : %s\\n\", doc->value.inscription[indice].moyen_de_com.numrg));\n" \
20427  " }\n" \
20428  "\n" \
20429  " if ((int4)GIV::GYBok == GIVvIndInscrip.sIndRGI)\n" \
20430  " {\n" \
20431  " strcpy(doc->value.inscription[indice].moyen_de_com.indrg, GIVvInscrip.acIndRG);\n" \
20432  " GWTTrace(GWT_NIV_FONCT, (\"INDRG : %s\\n\", doc->value.inscription[indice].moyen_de_com.indrg));\n" \
20433  " }\n" \
20434  "\n" \
20435  " if ((int4)GIV::GYBok == GIVvIndInscrip.sLaMarqueI)\n" \
20436  " {\n" \
20437  " strcpy(doc->value.inscription[indice].moyen_de_com.lamarque, GIVvInscrip.acLaMarque);\n" \
20438  " GWTTrace(GWT_NIV_FONCT, (\"LAMARQUE : %s\\n\", doc->value.inscription[indice].moyen_de_com.lamarque));\n" \
20439  " }\n" \
20440  "\n" \
20441  " if ((int4)GIV::GYBok == GIVvIndInscrip.sLaQualiteI)\n" \
20442  " {\n" \
20443  " strcpy(doc->value.inscription[indice].moyen_de_com.laqualite, GIVvInscrip.acLaQualite);\n" \
20444  " GWTTrace(GWT_NIV_FONCT, (\"LAQUALITE : %s\\n\", doc->value.inscription[indice].moyen_de_com.laqualite));\n" \
20445  " }\n" \
20446  "\n" \
20447  " if ((int4)GIV::GYBok == GIVvIndInscrip.sMntarifI)\n" \
20448  " {\n" \
20449  " strcpy(doc->value.inscription[indice].moyen_de_com.tarif_exact, GIVvInscrip.acMntarif);\n" \
20450  " GWTTrace(GWT_NIV_FONCT, (\"TARIF_EXACT : %s\\n\", doc->value.inscription[indice].moyen_de_com.tarif_exact));\n" \
20451  " }\n" \
20452  "\n" \
20453  " if ((int4)GIV::GYBok == GIVvIndInscrip.sCatNumI)\n" \
20454  " {\n" \
20455  " strcpy(doc->value.inscription[indice].moyen_de_com.catnum, GIVvInscrip.acCatNum);\n" \
20456  " GWTTrace(GWT_NIV_FONCT, (\"CAT_NUM : %s\\n\", doc->value.inscription[indice].moyen_de_com.catnum));\n" \
20457  " }\n" \
20458  "\n" \
20459  " /* réconciliation GPP */\n" \
20460  " doc->cIndRecGpp = GIVvInscrip.acIndRecGpp[0];\n" \
20461  " doc->cTypRecGpp = GIVvInscrip.acTypRecGpp[0];\n" \
20462  " GWTTrace(GWT_NIV_FONCT,\n" \
20463  " (\"Rec GPP : %c,%c\\n\", doc->cIndRecGpp, doc->cTypRecGpp));\n" \
20464  " iCodRet = GIV::GWCCodeOK;\n" \
20465  " /* Sortie de la fonction givMefMoyensTelecom */\n" \
20466  " return (iCodRet);\n" \
20467  "}\n" \
20468  "\n" \
20469  "/*----Fonction----------------------------------------------------------------*/\n" \
20470  "/* */\n" \
20471  "/* Fonction : givMefLieuParution () */\n" \
20472  "/* */\n" \
20473  "/* But : Mise en forme de l'ensemble \"lieu de parution\" */\n" \
20474  "/* */\n" \
20475  "/* */\n" \
20476  "/* */\n" \
20477  "/* Entree(s) : */\n" \
20478  "/* */\n" \
20479  "/* Sortie(s) : OK ou KO */\n" \
20480  "/* */\n" \
20481  "/* Portable : Transparent */\n" \
20482  "/* */\n" \
20483  "/*----------------------------------------------------------------------------*/\n" \
20484  "static int4 givMefLieuParution(GYBrDOCUMENTEpj* doc, int4 indice)\n" \
20485  "{\n" \
20486  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
20487  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
20488  " /* indicateur de parution */\n" \
20489  " strcpy(doc->value.intitule.parution, GIVvInscrip.acInparu);\n" \
20490  "\n" \
20491  " /* groupe des données définissant le lieu de parution */\n" \
20492  " /**---------------------------------------------------*/\n" \
20493  " if ((int4)GIV::GYBok == GIVvIndInscrip.sDepparI)\n" \
20494  " {\n" \
20495  " strcpy(doc->value.inscription[0].cDeppar, GIVvInscrip.acDeppar);\n" \
20496  " strcpy(doc->value.inscription[0].cLocpar, GIVvInscrip.acLocpar);\n" \
20497  " strcpy(doc->value.inscription[0].cArrpar, GIVvInscrip.acArrpar);\n" \
20498  "\n" \
20499  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
20500  " {\n" \
20501  " /* Erreur sur encodage TLV Deppar */\n" \
20502  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur sur encodage TLV du code departement de parution ...\\n\"));\n" \
20503  " iCodRet = (int4)GIV::GWCCodeKO;\n" \
20504  " }\n" \
20505  "\n" \
20506  " if ((int4)GIV::GYBok == GIVvIndInscrip.sLocparI)\n" \
20507  " {\n" \
20508  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
20509  " {\n" \
20510  " /* Erreur sur encodage TLV Locpar */\n" \
20511  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur sur encodage TLV du code localite de parution ...\\n\"));\n" \
20512  " iCodRet = (int4)GIV::GWCCodeKO;\n" \
20513  " }\n" \
20514  " }\n" \
20515  " }\n" \
20516  "\n" \
20517  " /* Sortie de la fonction givMefLieuParution */\n" \
20518  " return (iCodRet);\n" \
20519  "}\n" \
20520  "\n" \
20521  "/*----Fonction----------------------------------------------------------------*/\n" \
20522  "/* */\n" \
20523  "/* Fonction : givMefLieuInstallation () */\n" \
20524  "/* */\n" \
20525  "/* But : Mise en forme de l'ensemble \"lieu d'installation\" */\n" \
20526  "/* */\n" \
20527  "/* */\n" \
20528  "/* Entree(s) : */\n" \
20529  "/* */\n" \
20530  "/* Sortie(s) : OK ou KO */\n" \
20531  "/* */\n" \
20532  "/* Portable : Transparent */\n" \
20533  "/* */\n" \
20534  "/*----------------------------------------------------------------------------*/\n" \
20535  "/* */\n" \
20536  "/* Modification (Avr/25/2000 mb) : prise en compte des départment et localité */\n" \
20537  "/* d'installation */\n" \
20538  "/*----------------------------------------------------------------------------*/\n" \
20539  "/* */\n" \
20540  "/* Modification (Jan/10/2001 tw) : geocodage des inscriptions */\n" \
20541  "/*----------------------------------------------------------------------------*/\n" \
20542  "\n" \
20543  "int4 givMefLieuInstallation(GYBrDOCUMENTEpj* doc, int4 aindice)\n" \
20544  "{\n" \
20545  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
20546  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
20547  " int4 iRetCP;\n" \
20548  " int4 i, j, iIdx = 0; /* Index de boucle */\n" \
20549  " char cBufAdrnr[sizeof(GIVvInscrip.acAdrnr) + 1 + sizeof(GIVvLocrep.acCodpos) + 1 + sizeof(GIVvLocrep.acLibloc)] = \"\";\n" \
20550  " char cBufLibVoie[sizeof(GIVvInscrip.acTypvoi) + 1 + sizeof(GIVvInscrip.acLibvoi)] = \"\";\n" \
20551  " char cAdrnr[sizeof(GIVvInscrip.acAdrnr) + 1] = \"\";\n" \
20552  " char* pcChaine = NULL;\n" \
20553  " char* pcCp = NULL;\n" \
20554  " char tcLibTypVoi[ GYBPetvoiLgLibvoi + 1];\n" \
20555  " int4 iLocIns = 0;\n" \
20556  " int4 indice = 0;\n" \
20557  " int4 iFaireGeocod; /* si GIV::GWZOk on geocode */\n" \
20558  " double dWgsLon;\n" \
20559  " double dWgsLat;\n" \
20560  " /* initialisation données locales */\n" \
20561  " (void)memset(&cBufAdrnr[0], 0x00, sizeof(cBufAdrnr));\n" \
20562  " (void)memset(&cBufLibVoie[0], 0x00, sizeof(cBufLibVoie));\n" \
20563  " (void)memset(&cAdrnr[0], 0x00, sizeof(cAdrnr));\n" \
20564  " (void)memset(&tcLibTypVoi[0], ' ', GYBPetvoiLgLibvoi);\n" \
20565  " tcLibTypVoi[GYBPetvoiLgLibvoi] = '\\0';\n" \
20566  "\n" \
20567  " /* Mise en forme de \"ensemble de\" lieux d'installation */\n" \
20568  "\n" \
20569  " if ((int4)GIV::GYBok == GIVvIndInscrip.sCoddepI)\n" \
20570  " {\n" \
20571  " strcpy(doc->value.inscription[0].cCoddep, GIVvInscrip.acCoddep);\n" \
20572  " strcpy(doc->value.inscription[0].cCodloc, GIVvInscrip.acCodloc);\n" \
20573  " }\n" \
20574  "\n" \
20575  " if ((int4)GIV::GYBok == GIVvIndInscrip.sArrondI)\n" \
20576  " strcpy(doc->value.inscription[0].cArrond, GIVvInscrip.acArrond);\n" \
20577  "\n" \
20578  " /* indicateur de parution */\n" \
20579  " strcpy(doc->value.inscription[0].adresse.parution, doc->value.intitule.parution);\n" \
20580  " /* rang d'adresse non initialisé */\n" \
20581  " doc->value.inscription[indice].adresse.irangadr = (int4)0;\n" \
20582  "\n" \
20583  " /* gestion de l'adresse */\n" \
20584  " /**---------------------*/\n" \
20585  " if (givcParuSSAdr != GIVvInscrip.acInparu[givcIndParuAdr])\n" \
20586  " {\n" \
20587  " /* parution de l'adresse */\n" \
20588  " if (givcParuSSNo != GIVvInscrip.acInparu[givcIndParuAdr])\n" \
20589  " {\n" \
20590  " /* parution du numéro dans la voie */\n" \
20591  " if ((int4)GIV::GYBok == GIVvIndInscrip.sNovoieI)\n" \
20592  " {\n" \
20593  " /* Encodage du numero dans la voie */\n" \
20594  " strcpy(doc->value.inscription[indice].adresse.numero_voie, GIVvInscrip.acNovoie);\n" \
20595  " GWTTrace(GWT_NIV_FONCT, (\"NoVOIE : %s\\n\", doc->value.inscription[indice].adresse.numero_voie));\n" \
20596  "\n" \
20597  " if ((int4)GIV::GYBok == GIVvIndInscrip.sCplnovI)\n" \
20598  " {\n" \
20599  " /* Encodage du complement de numero dans la voie */\n" \
20600  " strcpy(doc->value.inscription[indice].adresse.complt_num_voie, GIVvInscrip.acCplnov);\n" \
20601  " GWTTrace(GWT_NIV_FONCT, (\"COMP_NoVOIE : %s\\n\", doc->value.inscription[indice].adresse.complt_num_voie));\n" \
20602  "\n" \
20603  " switch (GIVvInscrip.acCplnov[0])\n" \
20604  " {\n" \
20605  " /** Ne pas traduire A B C et D */\n" \
20606  " case '1':\n" \
20607  " break;\n" \
20608  "\n" \
20609  " case '2':\n" \
20610  " strcpy(doc->value.inscription[indice].adresse.lib_complt_num_voie, \"Bis\");\n" \
20611  " break;\n" \
20612  "\n" \
20613  " case '3':\n" \
20614  " strcpy(doc->value.inscription[indice].adresse.lib_complt_num_voie, \"Ter\");\n" \
20615  " break;\n" \
20616  "\n" \
20617  " case '4':\n" \
20618  " strcpy(doc->value.inscription[indice].adresse.lib_complt_num_voie, \"Quater\");\n" \
20619  " break;\n" \
20620  "\n" \
20621  " case '5':\n" \
20622  " strcpy(doc->value.inscription[indice].adresse.lib_complt_num_voie, \"Quinquies\");\n" \
20623  " break;\n" \
20624  "\n" \
20625  " case '6':\n" \
20626  " strcpy(doc->value.inscription[indice].adresse.lib_complt_num_voie, \"Sexto\");\n" \
20627  " break;\n" \
20628  "\n" \
20629  " default:\n" \
20630  " strcpy(doc->value.inscription[indice].adresse.lib_complt_num_voie, doc->value.inscription[indice].adresse.complt_num_voie);\n" \
20631  " break;\n" \
20632  " }\n" \
20633  "\n" \
20634  " GWTTrace(GWT_NIV_FONCT, (\"LIB_COMP_NoVOIE : %s\\n\", doc->value.inscription[indice].adresse.lib_complt_num_voie));\n" \
20635  " }\n" \
20636  " }\n" \
20637  " }\n" \
20638  "\n" \
20639  " if ((int4)GIV::GYBok == GIVvIndInscrip.sCodvoiI)\n" \
20640  " {\n" \
20641  " /* Encodage du code voie repertoriee */\n" \
20642  " strcpy(doc->value.inscription[indice].adresse.code_voie, GIVvInscrip.acCodvoi);\n" \
20643  " GWTTrace(GWT_NIV_FONCT, (\"CODE_VOIE : %s\\n\", doc->value.inscription[indice].adresse.code_voie));\n" \
20644  " }\n" \
20645  "\n" \
20646  " if ((int4)GIV::GYBok == GIVvIndInscrip.sLibvoiI)\n" \
20647  " {\n" \
20648  " if ((int4)GIV::GYBok == GIVvIndInscrip.sTypvoiI)\n" \
20649  " {\n" \
20650  " /** 14/09/1998 LGU ANO_xxxx Traduire le type de voie en fonction du contenu de GYTtabPetvoi */\n" \
20651  " /* Traduire le type de voie */\n" \
20652  " iCodRet = GIVTradTypvoi(GIVvInscrip.acTypvoi, tcLibTypVoi);\n" \
20653  "\n" \
20654  " if (GIV::GWCCodeOK != iCodRet)\n" \
20655  " {\n" \
20656  " strcpy(tcLibTypVoi, GIVvInscrip.acTypvoi);\n" \
20657  " iCodRet = GIV::GWCCodeOK;\n" \
20658  " }\n" \
20659  "\n" \
20660  " /* Suppression des blancs éventuels derrière le type de voie*/\n" \
20661  " for (iIdx = (strlen(tcLibTypVoi) - 1); (0 <= iIdx) && (tcLibTypVoi[iIdx] == GIV_CHAR_BLANC); iIdx--)\n" \
20662  " tcLibTypVoi[iIdx] = '\\0';\n" \
20663  "\n" \
20664  " /* type de voie */\n" \
20665  " strcpy(doc->value.inscription[indice].adresse.type_voie, tcLibTypVoi);\n" \
20666  " GWTTrace(GWT_NIV_FONCT, (\"TYPE_VOIE : %s\\n\", doc->value.inscription[indice].adresse.type_voie));\n" \
20667  " /* Concaténation du type de voie et du libellé de voie */\n" \
20668  " (void)sprintf(&cBufLibVoie[0], \"%s %s\", tcLibTypVoi, GIVvInscrip.acLibvoi);\n" \
20669  " /** 14/09/1998 LGU ANO_xxxx fin de modif */\n" \
20670  " }\n" \
20671  " else\n" \
20672  " (void)strcpy(&cBufLibVoie[0], GIVvInscrip.acLibvoi);\n" \
20673  "\n" \
20674  " /* Encodage du libelle de voie */\n" \
20675  " if ((int4)GIV::GYBok == GIVvIndInscrip.sCodvoiI)\n" \
20676  " {\n" \
20677  " /* voie répertoriée */\n" \
20678  " strcpy(doc->value.inscription[indice].adresse.lib_code_voie, cBufLibVoie);\n" \
20679  " GWTTrace(GWT_NIV_FONCT, (\"LIBEL_VOIE : %s\\n\", doc->value.inscription[indice].adresse.lib_code_voie));\n" \
20680  " }\n" \
20681  " else\n" \
20682  " {\n" \
20683  " /* voie non répertoriée */\n" \
20684  " strcpy(doc->value.inscription[indice].adresse.libel_voie, cBufLibVoie);\n" \
20685  " GWTTrace(GWT_NIV_FONCT, (\"LIBEL_VOIE : %s\\n\", doc->value.inscription[indice].adresse.libel_voie));\n" \
20686  " }\n" \
20687  " }\n" \
20688  " else\n" \
20689  " {\n" \
20690  " /* Si le libelle de voie n'est pas dans le référentiel inscription */\n" \
20691  " /* s'il existe un code voie repertoriee */\n" \
20692  " /* le recuperer dans la table PEVREP*/\n" \
20693  " /* S'il n'y a pas de code voie, ne rien faire */\n" \
20694  " if ((int4)GIV::GYBok == GIVvIndInscrip.sCodvoiI)\n" \
20695  " {\n" \
20696  " iIntRet = GIVLectureTabPEVREP(GIVvInscrip.acDeppar, GIVvInscrip.acLocpar, GIVvInscrip.acCodvoi);\n" \
20697  "\n" \
20698  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
20699  " {\n" \
20700  " /* Si le libelle de voie a ete trouve dans la table voies repertoriees */\n" \
20701  " /* le charger dans le mouvement CD */\n" \
20702  " if (0 != GIViNbTuplePevrep)\n" \
20703  " {\n" \
20704  " /* Encodage du libelle de voie */\n" \
20705  " strcpy(doc->value.inscription[indice].adresse.lib_code_voie, GIVvVoirep.acLibvoi);\n" \
20706  " GWTTrace(GWT_NIV_FONCT, (\"LIBEL_VOIE : %s\\n\", doc->value.inscription[indice].adresse.lib_code_voie));\n" \
20707  " }\n" \
20708  " else\n" \
20709  " {\n" \
20710  " /* Si le libelle de voie repertoriee n'existe pas dans la base PEVREP, generer une signalisation */\n" \
20711  " GWTTrace(GWT_NIV_BIZAR, (\"Libelle de voie repertoriee non trouve ...\\n\"));\n" \
20712  " }\n" \
20713  " }\n" \
20714  " else\n" \
20715  " {\n" \
20716  " /* La consultation de la table voie repertoriee s'est mal passee */\n" \
20717  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur sur acces a la table voie repertoriee ...\\n\"));\n" \
20718  " iCodRet = (int4)GIV::GWCCodeKO;\n" \
20719  " }\n" \
20720  " }\n" \
20721  " }\n" \
20722  "\n" \
20723  " if ((int4)GIV::GYBok == GIVvIndInscrip.sEnsbatI)\n" \
20724  " {\n" \
20725  " /* Encodage de l'ensemble batiment */\n" \
20726  " strcpy(doc->value.inscription[indice].adresse.ensemble_batiment, GIVvInscrip.acEnsbat);\n" \
20727  " GWTTrace(GWT_NIV_FONCT, (\"ENSEMBLE_BAT : %s\\n\", doc->value.inscription[indice].adresse.ensemble_batiment));\n" \
20728  " }\n" \
20729  "\n" \
20730  " if ((int4)GIV::GYBok == GIVvIndInscrip.sLieuaeI)\n" \
20731  " {\n" \
20732  " /* Encodage du lieu dit AE*/\n" \
20733  " strcpy(doc->value.inscription[indice].adresse.lieue_ae, GIVvInscrip.acLieuae);\n" \
20734  " GWTTrace(GWT_NIV_FONCT, (\"LIEU_AE : %s\\n\", doc->value.inscription[indice].adresse.lieue_ae));\n" \
20735  " }\n" \
20736  " }\n" \
20737  "\n" \
20738  " if ((givcParuSSAdr != GIVvInscrip.acInparu[givcIndParuAdr]) || ((0 == strcmp(GIVtcGeneSSAdr, \"OUI\")) && (givcParuSSAdr == doc->value.intitule.parution[givcIndParuAdr])))\n" \
20739  " {\n" \
20740  " /* traitement du champ adresse non répertoriée */\n" \
20741  " /**--------------------------------------------*/\n" \
20742  " /* on récupère l'adrnr de l'inscription si elle existe */\n" \
20743  " if (((int4)GIV::GYBok == GIVvIndInscrip.sAdrnrI) && ((0 == strcmp(\"0000\", cNumls)) || (0 == strcmp(GIVtcGeneCP, \"OUI\"))))\n" \
20744  " {\n" \
20745  " /* recherche de l'existence d'un code postal dans l'adresse */\n" \
20746  " iIntRet = GIV::GWCCodeKO;\n" \
20747  " iRetCP = GIV::GWCCodeOK;\n" \
20748  " (void)strcpy(cAdrnr, GIVvInscrip.acAdrnr);\n" \
20749  " pcChaine = strtok(cAdrnr, \" \");\n" \
20750  "\n" \
20751  " while ((NULL != pcChaine) && (GIV::GWCCodeKO == iIntRet))\n" \
20752  " {\n" \
20753  " if ((sizeof(GIVvLocrep.acCodpos) - 1) == strlen(pcChaine))\n" \
20754  " {\n" \
20755  " for (iIdx = 0; isdigit(pcChaine[iIdx]); iIdx++)\n" \
20756  " ;\n" \
20757  "\n" \
20758  " if ((sizeof(GIVvLocrep.acCodpos) - 1) == iIdx)\n" \
20759  " iIntRet = GIV::GWCCodeOK;\n" \
20760  " }\n" \
20761  "\n" \
20762  " /* passer au mot suivant */\n" \
20763  " if ((GIV::GWCCodeOK == iRetCP) && (GIV::GWCCodeOK == iIntRet))\n" \
20764  " pcCp = pcChaine + strlen(pcChaine) + 1;\n" \
20765  " else\n" \
20766  " {\n" \
20767  " iRetCP = GIV::GWCCodeKO;\n" \
20768  " pcChaine = strtok(NULL, \" \");\n" \
20769  " }\n" \
20770  " }\n" \
20771  "\n" \
20772  " /* recherche du CODDEP dans l'adresse */\n" \
20773  " if (NULL != strstr(GIVvInscrip.acAdrnr, GIVvInscrip.acCoddep))\n" \
20774  " iIntRet = GIV::GWCCodeOK;\n" \
20775  "\n" \
20776  " GIVvInscrip.searchCODDEPInAdress(iIntRet, GIV::GWCCodeOK, cBufAdrnr, GIVtcGeneCP, iRetCP, cNumls, pcCp, cAdrnr, &GIVvIndInscrip, &GIVvLocrep, GIV::GYBok);\n" \
20777  "\n" \
20778  " \n" \
20779  " }\n" \
20780  " else if (((int4)GIV::GYBok == GIVvIndInscrip.sAdrnrI) && (0 != strcmp(\"0000\", cNumls)))\n" \
20781  " {\n" \
20782  " /* adrnr déjà formaté */\n" \
20783  " (void)strcpy(cBufAdrnr, GIVvInscrip.acAdrnr);\n" \
20784  " }\n" \
20785  "\n" \
20786  " if ((0 != strlen(cBufAdrnr)) && (givcParuSSAdr != GIVvInscrip.acInparu[givcIndParuAdr]))\n" \
20787  " {\n" \
20788  " /* Encodage de l'adresse non repertoriee */\n" \
20789  " strcpy(doc->value.inscription[indice].adresse.adrnr, cBufAdrnr);\n" \
20790  " GWTTrace(GWT_NIV_FONCT, (\"ADRNR : %s\\n\", doc->value.inscription[indice].adresse.adrnr));\n" \
20791  " }\n" \
20792  " else\n" \
20793  " {\n" \
20794  " /* pas Encodage de l'adresse non repertoriee */\n" \
20795  " strcpy(doc->value.inscription[indice].adresse.adrnr, \"\");\n" \
20796  " GWTTrace(GWT_NIV_FONCT, (\"ADRNR : %s\\n\", doc->value.inscription[indice].adresse.adrnr));\n" \
20797  " }\n" \
20798  " }\n" \
20799  "\n" \
20800  " if ((int4)GIV::GYBok == GIVvIndInscrip.sArrondI)\n" \
20801  " {\n" \
20802  " if (((0 == strcmp(GIVtcGeneSSAdr, \"OUI\")) && (givcParuSSAdr == doc->value.intitule.parution[givcIndParuAdr])) || (givcParuSSAdr != GIVvInscrip.acInparu[givcIndParuAdr]))\n" \
20803  " {\n" \
20804  " /* Encodage du code arrondissement */\n" \
20805  " strcpy(doc->value.inscription[indice].adresse.arrondissement, GIVvInscrip.acArrond);\n" \
20806  " GWTTrace(GWT_NIV_FONCT, (\"ARROND : %s\\n\", doc->value.inscription[indice].adresse.arrondissement));\n" \
20807  " }\n" \
20808  " }\n" \
20809  "\n" \
20810  " /* les informations BP, code cedex et libellé cedex sont conditionnées par */\n" \
20811  " /* presence du code cedex et un libellé existe en association avec ce code */\n" \
20812  " if (((int4)GIV::GYBok == GIVvIndInscrip.sCodcdxI) && ((givcParuSSAdr != GIVvInscrip.acInparu[givcIndParuAdr]) || ((0 == strcmp(GIVtcGeneSSAdr, \"OUI\"))\n" \
20813  " && (givcParuSSAdr == doc->value.intitule.parution[givcIndParuAdr]))))\n" \
20814  " {\n" \
20815  " /* Recuperation du libelle cedex */\n" \
20816  " iIntRet = GIVLectureTabPECDEX(GIVvInscrip.acCodcdx);\n" \
20817  "\n" \
20818  " if ((int4)0 < GIViNbTuplePecdex)\n" \
20819  " {\n" \
20820  " /* on a un tuple libellé cedex */\n" \
20821  " /* Encodage du code Cedex */\n" \
20822  " strcpy(doc->value.inscription[indice].adresse.code_cedex, GIVvInscrip.acCodcdx);\n" \
20823  " strcpy(doc->value.inscription[indice].adresse.lib_cedex, GIVvCedex.acLibcdx);\n" \
20824  " GWTTrace(GWT_NIV_FONCT, (\"CODE_CEDEX : %s\\n\", doc->value.inscription[indice].adresse.code_cedex));\n" \
20825  " }\n" \
20826  " }\n" \
20827  " else\n" \
20828  " {\n" \
20829  " /* le code postal n'a de sens qu'en absence du code cedex */\n" \
20830  " if (((int4)GIV::GYBok == GIVvIndInscrip.sCodposI) && ((givcParuSSAdr != GIVvInscrip.acInparu[givcIndParuAdr]) || ((0 == strcmp(GIVtcGeneSSAdr, \"OUI\"))\n" \
20831  " && (givcParuSSAdr == doc->value.intitule.parution[givcIndParuAdr]))))\n" \
20832  " {\n" \
20833  " /* Encodage du code postal */\n" \
20834  " strcpy(doc->value.inscription[indice].adresse.code_postal, GIVvInscrip.acCodpos);\n" \
20835  " GWTTrace(GWT_NIV_FONCT, (\"CODE_POSTAL : %s\\n\", doc->value.inscription[indice].adresse.code_postal));\n" \
20836  " }\n" \
20837  " }\n" \
20838  "\n" \
20839  " if (((int4)GIV::GYBok == GIVvIndInscrip.sBoiteI) && (givcParuSSAdr != GIVvInscrip.acInparu[givcIndParuAdr]))\n" \
20840  " {\n" \
20841  " /* Encodage du numero de la boite postale */\n" \
20842  " strcpy(doc->value.inscription[indice].adresse.boite, GIVvInscrip.acBoite);\n" \
20843  " GWTTrace(GWT_NIV_FONCT, (\"BOITE : %s\\n\", doc->value.inscription[indice].adresse.boite));\n" \
20844  " }\n" \
20845  "\n" \
20846  " /* localité d'installation */\n" \
20847  " if (((0 == strcmp(GIVtcGeneSSAdr, \"OUI\")) && (givcParuSSAdr == doc->value.intitule.parution[givcIndParuAdr])) || (givcParuSSAdr != GIVvInscrip.acInparu[givcIndParuAdr]))\n" \
20848  " {\n" \
20849  " if ((int4)GIV::GYBok == GIVvIndInscrip.sCoddepI)\n" \
20850  " {\n" \
20851  " sprintf(doc->value.inscription[indice].adresse.instal, \"%s%s\", GIVvInscrip.acCoddep, GIVvInscrip.acCodloc);\n" \
20852  "\n" \
20853  " if ((int4)GIV::GYBok == GIVvIndInscrip.sArrondI)\n" \
20854  " iIntRet = GIVLectureArrPELREP(GIVvInscrip.acCoddep, GIVvInscrip.acCodloc, GIVvInscrip.acArrond);\n" \
20855  " else\n" \
20856  " iIntRet = GIVLectureTabPELREP(GIVvInscrip.acCoddep, GIVvInscrip.acCodloc);\n" \
20857  " }\n" \
20858  " else\n" \
20859  " {\n" \
20860  " sprintf(doc->value.inscription[indice].adresse.instal, \"%s%s\", GIVvInscrip.acDeppar, GIVvInscrip.acLocpar);\n" \
20861  "\n" \
20862  " if ((int4)GIV::GYBok == GIVvIndInscrip.sArrondI)\n" \
20863  " iIntRet = GIVLectureArrPELREP(GIVvInscrip.acDeppar, GIVvInscrip.acLocpar, GIVvInscrip.acArrond);\n" \
20864  " else\n" \
20865  " iIntRet = GIVLectureTabPELREP(GIVvInscrip.acDeppar, GIVvInscrip.acLocpar);\n" \
20866  " }\n" \
20867  "\n" \
20868  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
20869  " {\n" \
20870  " /* libellé de localité */\n" \
20871  " strcpy(doc->value.inscription[indice].adresse.libinstal, GIVvLocrep.acLibloc);\n" \
20872  " }\n" \
20873  " else if (0 == strcmp(GIVvInscrip.acLocpar, givcLocFictive))\n" \
20874  " strcpy(doc->value.inscription[indice].adresse.libinstal, \"LOCALITE FICTIVE\");\n" \
20875  "\n" \
20876  " if (GIVvIndInscrip.isActivityLocDep(GIV::GYBok, GIVtcGeneActiv,\"OUI\"))\n" \
20877  " {\n" \
20878  " if (0 != strlen(doc->value.rubriques.arract))\n" \
20879  " iIntRet = GIVLectureArrPELREP(doc->value.rubriques.depact, doc->value.rubriques.locact, doc->value.rubriques.arract);\n" \
20880  " else\n" \
20881  " iIntRet = GIVLectureTabPELREP(doc->value.rubriques.depact, doc->value.rubriques.locact);\n" \
20882  "\n" \
20883  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
20884  " {\n" \
20885  " /* libellé de localité */\n" \
20886  " strcpy(doc->value.inscription[indice].adresse.libinstact, GIVvLocrep.acLibloc);\n" \
20887  " }\n" \
20888  " }\n" \
20889  " }\n" \
20890  "\n" \
20891  " GWTTrace(GWT_NIV_FONCT, (\"INSTAL : %s\\n\", doc->value.inscription[indice].adresse.instal));\n" \
20892  "\n" \
20893  " if (((int4)GIV::GYBok != GIVvIndInscrip.sCodposI) && ((int4)GIV::GYBok != GIVvIndInscrip.sCodcdxI) && ((int4)GIV::GYBok != GIVvIndInscrip.sBoiteI) && (0 == strcmp(\"0000\", GIVvInscrip.acNumls))\n" \
20894  " && ((givcParuSSAdr != GIVvInscrip.acInparu[givcIndParuAdr]) || ((0 == strcmp(GIVtcGeneSSAdr, \"OUI\")) && (givcParuSSAdr == doc->value.intitule.parution[givcIndParuAdr]))))\n" \
20895  " {\n" \
20896  " /* Encodage du code postal */\n" \
20897  " strcpy(doc->value.inscription[indice].adresse.code_postal, GIVvLocrep.acCodpos);\n" \
20898  " GWTTrace(GWT_NIV_FONCT, (\"CODE_POSTAL LO : %s\\n\", doc->value.inscription[indice].adresse.code_postal));\n" \
20899  " }\n" \
20900  "\n" \
20901  " /* groupe de données de géocodage */\n" \
20902  " /* ------------------------------ */\n" \
20903  " GWTTrace(GWT_NIV_FONCT, (\"Valeurs de la rGeocod avant encodage: <iStatus=%d>,<tcX=%s>, <tcY=%s>, <tcQualite=%s>\\n\", GIVvGeocod.iStatus, GIVvGeocod.tcX, GIVvGeocod.tcY, GIVvGeocod.tcQualite));\n" \
20904  " strcpy(doc->value.inscription[indice].adresse.geoloc.precision, GIVvGeocod.tcQualite);\n" \
20905  " GWTTrace(GWT_NIV_FONCT, (\"QUALITE : %s\\n\", doc->value.inscription[indice].adresse.geoloc.precision));\n" \
20906  " strcpy(doc->value.inscription[indice].adresse.geoloc.precMappy, GIVvGeocod.tcPrecMappy);\n" \
20907  "\n" \
20908  " if (GIVvGeocod.isStatus(GIVGeocodSEnvXYQ, GIVGeocodSEnvXY))\n" \
20909  " {\n" \
20910  " strcpy(doc->value.inscription[indice].adresse.geoloc.longitude, GIVvGeocod.tcLongitude);\n" \
20911  " GWTTrace(GWT_NIV_FONCT, (\"LONGITUDE : %s\\n\", doc->value.inscription[indice].adresse.geoloc.longitude));\n" \
20912  " strcpy(doc->value.inscription[indice].adresse.geoloc.latitude, GIVvGeocod.tcLatitude);\n" \
20913  " GWTTrace(GWT_NIV_FONCT, (\"LATITUDE : %s\\n\", doc->value.inscription[indice].adresse.geoloc.latitude));\n" \
20914  " GWTTrace(GWT_NIV_FONCT, (\"LONGITUDE WGS : %s\\n\", doc->value.inscription[indice].adresse.geoloc.longitude));\n" \
20915  " GWTTrace(GWT_NIV_FONCT, (\"LATITUDE WGS : %s\\n\", doc->value.inscription[indice].adresse.geoloc.latitude));\n" \
20916  " }\n" \
20917  "\n" \
20918  " /* Sortie de la fonction givMefLieuInstallation */\n" \
20919  " return (iCodRet);\n" \
20920  "}\n" \
20921  "\n" \
20922  "/*----Fonction----------------------------------------------------------------*/\n" \
20923  "/* */\n" \
20924  "/* Fonction : givMefProfessionnel () */\n" \
20925  "/* */\n" \
20926  "/* But : Mise en forme de l'ensemble \"professionnel\" */\n" \
20927  "/* */\n" \
20928  "/* */\n" \
20929  "/* */\n" \
20930  "/* Entree(s) : */\n" \
20931  "/* */\n" \
20932  "/* Sortie(s) : OK ou KO */\n" \
20933  "/* */\n" \
20934  "/* Portable : Transparent */\n" \
20935  "/* */\n" \
20936  "/*----------------------------------------------------------------------------*/\n" \
20937  "\n" \
20938  "static int4 givMefProfessionnel(GYBrDOCUMENTEpj* doc, int4 aindice)\n" \
20939  "{\n" \
20940  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
20941  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
20942  " int4 i, giviInsertTLV = 0; /* indice de deplacement dans le tableau AN9 de depart */\n" \
20943  " char givcAn9Courant[GYBPaprofLgCodan9 + 1] = givcR00000000;\n" \
20944  " char givcOrigCourant[GYBIaprofLgOrigine + 1] = \"\" \"\";\n" \
20945  " /* Initialisation du nombre d'An9 */\n" \
20946  " char conf[50];\n" \
20947  " nb_an9 = 0;\n" \
20948  " nb_marque = 0;\n" \
20949  " GWTTrace(GWT_NIV_FONCT, (\" Entrer CodeAn9... %s\\n\"));\n" \
20950  "\n" \
20951  " if (GIV::GIXCodeOK == (int1)GIVcPresenceAn9)\n" \
20952  " {\n" \
20953  " /* Mise en forme de l'ensemble \"critere professionnel\" */\n" \
20954  " /* tant qu'il existe des elements dans le tableau des AN9 */\n" \
20955  " giviInsertTLV = GIViNbTupleIaprof;\n" \
20956  "\n" \
20957  " while (giviInsertTLV < GIViNbMaxTabAn9)\n" \
20958  " {\n" \
20959  " if ((0 != strcmp(givcAn9Courant, GIVtrProfIns[giviInsertTLV].acCodan8)) || (0 != strcmp(givcOrigCourant, GIVtrProfIns[giviInsertTLV].acOrigine)))\n" \
20960  " {\n" \
20961  " if (0 != memcmp(\"78\", GIVtrProfIns[giviInsertTLV].acCodan8, strlen(\"78\")))\n" \
20962  " {\n" \
20963  " /* ne pas garder les rubriques \"rue commerçante\" */\n" \
20964  " if (MAX_AN9 == nb_an9)\n" \
20965  " {\n" \
20966  " /* probleme max AN9 atteint */\n" \
20967  " GWTTrace(GWT_NIV_GRAVE, (\"probleme max AN9 atteint\"));\n" \
20968  " iCodRet = GIV::GIXCodeKO;\n" \
20969  " break;\n" \
20970  " }\n" \
20971  "\n" \
20972  " /* Changement d'AN9, demarrage d'un critère professionnel */\n" \
20973  " /* préalablement on supprime les marques / spécialités associées à l'AN9 précédent s'il est vide */\n" \
20974  " /* sous réserve que l'on ait déjà traité un AN9 */\n" \
20975  " strcpy(doc->value.rubriques.Tan9[nb_an9].val_codan9, GIVtrProfIns[giviInsertTLV].acCodan8);\n" \
20976  " strcpy(doc->value.rubriques.Tan9[nb_an9].val_codan8, GIVtrProfIns[giviInsertTLV].acCodInit);\n" \
20977  " strcpy(doc->value.rubriques.Tan9[nb_an9].nature, GIVtrProfIns[giviInsertTLV].acNature);\n" \
20978  " doc->value.rubriques.Tan9[nb_an9].orig = GIVtrProfIns[giviInsertTLV].acOrigine[0];\n" \
20979  " doc->value.rubriques.Tan9[nb_an9].paru = GIVtrProfIns[giviInsertTLV].acParuloc[0];\n" \
20980  " doc->value.rubriques.Tan9[nb_an9].recgpp = GIVtrProfIns[giviInsertTLV].acRecGpp[0];\n" \
20981  " doc->value.rubriques.Tan9[nb_an9].dnex = GIVtrProfIns[giviInsertTLV].acPjdc;\n" \
20982  " strcpy(doc->value.rubriques.Tan9[nb_an9].thematique, GIVtrProfIns[giviInsertTLV].thematique);\n" \
20983  " GWTTrace(GWT_NIV_FONCT, (\" CodeAn9... %s\\n\", doc->value.rubriques.Tan9[nb_an9].val_codan9));\n" \
20984  " GWTTrace(GWT_NIV_FONCT, (\" CodeAn8... %s\\n\", doc->value.rubriques.Tan9[nb_an9].val_codan8));\n" \
20985  " GWTTrace(GWT_NIV_FONCT, (\" Nature... %s\\n\", doc->value.rubriques.Tan9[nb_an9].nature));\n" \
20986  " GWTTrace(GWT_NIV_FONCT, (\" Paruloc... %c\\n\", doc->value.rubriques.Tan9[nb_an9].paru));\n" \
20987  " GWTTrace(GWT_NIV_FONCT, (\" No_indice : ... %d\\n\", nb_an9));\n" \
20988  " nb_an9++;\n" \
20989  " }\n" \
20990  " }\n" \
20991  "\n" \
20992  " /* Memorisation du dernier AN9 traite */\n" \
20993  " GIVtrProfIns[giviInsertTLV].memlastAN9(givcAn9Courant, givcOrigCourant);\n" \
20994  " giviInsertTLV++;\n" \
20995  " }\n" \
20996  " }\n" \
20997  " else if ('0' == GIVvInscrip.acIndPart[0])\n" \
20998  " {\n" \
20999  " if (MAX_AN9 == nb_an9)\n" \
21000  " {\n" \
21001  " /* probleme max AN9 atteint */\n" \
21002  " GWTTrace(GWT_NIV_GRAVE, (\"probleme max AN9 atteint\"));\n" \
21003  " iCodRet = GIV::GIXCodeKO;\n" \
21004  " }\n" \
21005  " else\n" \
21006  " {\n" \
21007  " /* defaut absence de rubrique */\n" \
21008  " strcpy(doc->value.rubriques.Tan9[nb_an9].val_codan9, givcR00000000);\n" \
21009  " strcpy(doc->value.rubriques.Tan9[nb_an9].val_codan8, givcR000000);\n" \
21010  " doc->value.rubriques.Tan9[nb_an9].paru = '0';\n" \
21011  " doc->value.rubriques.Tan9[nb_an9].dnex = '0';\n" \
21012  " doc->value.rubriques.Tan9[nb_an9].recgpp = '0';\n" \
21013  " strcpy(doc->value.rubriques.Tan9[nb_an9].thematique, \"\");\n" \
21014  " GWTTrace(GWT_NIV_FONCT, (\" CodeAn9... %s\\n\", doc->value.rubriques.Tan9[nb_an9].val_codan9));\n" \
21015  " nb_an9++;\n" \
21016  " }\n" \
21017  " }\n" \
21018  "\n" \
21019  " if ((GIV::GIXCodeOK != (int1)GIVcPresenceAn9) && ('0' != GIVvInscrip.acIndPart[0]))\n" \
21020  " {\n" \
21021  " for (i = 0; i < GIViNbTupleIapart; i++)\n" \
21022  " {\n" \
21023  " (void)strcpy(givtcOriPart, GIVtrPart[i].acOriPart);\n" \
21024  " (void)sprintf(conf, \"%s_%s\", \"GIV_AN9_PART\", GIVtrPart[i].acOriPart);\n" \
21025  " iIntRet = GWTLireConf(conf, givtcAn9Part);\n" \
21026  "\n" \
21027  " if (GIV::GWTok != iIntRet)\n" \
21028  " {\n" \
21029  " /* defaut absence de rubrique */\n" \
21030  " (void)strcpy(givtcAn9Part, givcR00000000);\n" \
21031  " (void)strcpy(givtcAn8Part, givcR000000);\n" \
21032  " }\n" \
21033  "\n" \
21034  " (void)sprintf(conf, \"%s_%s\", \"GIV_AN8_PART\", GIVtrPart[i].acOriPart);\n" \
21035  " iIntRet = GWTLireConf(conf, givtcAn8Part);\n" \
21036  "\n" \
21037  " if (MAX_AN9 == nb_an9)\n" \
21038  " {\n" \
21039  " /* probleme max AN9 atteint */\n" \
21040  " GWTTrace(GWT_NIV_GRAVE, (\"probleme max AN9 atteint\"));\n" \
21041  " iCodRet = GIV::GIXCodeKO;\n" \
21042  " }\n" \
21043  " else\n" \
21044  " {\n" \
21045  " strcpy(doc->value.rubriques.Tan9[nb_an9].val_codan9, givtcAn9Part);\n" \
21046  " strcpy(doc->value.rubriques.Tan9[nb_an9].val_codan8, givtcAn8Part);\n" \
21047  " doc->value.rubriques.Tan9[nb_an9].orig = '1';\n" \
21048  " doc->value.rubriques.Tan9[nb_an9].paru = '0';\n" \
21049  " doc->value.rubriques.Tan9[nb_an9].dnex = '0';\n" \
21050  " doc->value.rubriques.Tan9[nb_an9].recgpp = '0';\n" \
21051  " strcpy(doc->value.rubriques.Tan9[nb_an9].thematique, \"\");\n" \
21052  " GWTTrace(GWT_NIV_FONCT, (\" CodeAn9 Part %s\\n\", doc->value.rubriques.Tan9[nb_an9].val_codan9));\n" \
21053  " nb_an9++;\n" \
21054  " }\n" \
21055  " }\n" \
21056  "\n" \
21057  " if (0 == GIViNbTupleIapart)\n" \
21058  " {\n" \
21059  " /* defaut absence de rubrique */\n" \
21060  " strcpy(doc->value.rubriques.Tan9[nb_an9].val_codan9, givcR00000000);\n" \
21061  " strcpy(doc->value.rubriques.Tan9[nb_an9].val_codan8, givcR000000);\n" \
21062  " doc->value.rubriques.Tan9[nb_an9].paru = '0';\n" \
21063  " doc->value.rubriques.Tan9[nb_an9].dnex = '0';\n" \
21064  " doc->value.rubriques.Tan9[nb_an9].recgpp = '0';\n" \
21065  " strcpy(doc->value.rubriques.Tan9[nb_an9].thematique, \"\");\n" \
21066  " GWTTrace(GWT_NIV_FONCT, (\" CodeAn9... %s\\n\", doc->value.rubriques.Tan9[nb_an9].val_codan9));\n" \
21067  " nb_an9++;\n" \
21068  " }\n" \
21069  " }\n" \
21070  "\n" \
21071  " doc->value.rubriques.iNban9 = nb_an9;\n" \
21072  "\n" \
21073  " /* Mise en place de la mention professionnelle : ODA payante prioritaire et 14D gratuite */\n" \
21074  " /* dans deux champs différents */\n" \
21075  "\n" \
21076  " if ((int4)GIV::GYBok == GIVvIndInscrip.sMenormI)\n" \
21077  " {\n" \
21078  " strcpy(doc->value.rubriques.mpg, GIVvInscrip.acMenorm);\n" \
21079  " GWTTrace(GWT_NIV_FONCT, (\"MPG : ... %s\\n\", doc->value.rubriques.mpg));\n" \
21080  " }\n" \
21081  "\n" \
21082  " if ((int4)GIV::GYBok == GIVvIndInscrip.sMenadjI)\n" \
21083  " {\n" \
21084  " strcpy(doc->value.rubriques.mogmoi, GIVvInscrip.acMenadj);\n" \
21085  " GWTTrace(GWT_NIV_FONCT, (\"MOGMOI : ... %s\\n\", doc->value.rubriques.mogmoi));\n" \
21086  " }\n" \
21087  "\n" \
21088  " /* Sortie de la fonction givMefProfessionnel */\n" \
21089  " return (iCodRet);\n" \
21090  "}\n" \
21091  "\n" \
21092  "/*----Fonction----------------------------------------------------------------*/\n" \
21093  "/* */\n" \
21094  "/* Fonction : givMefCRC () */\n" \
21095  "/* */\n" \
21096  "/* But : Mise en forme de l'ensemble critère complémentaire */\n" \
21097  "/* */\n" \
21098  "/* */\n" \
21099  "/* */\n" \
21100  "/* Entree(s) : */\n" \
21101  "/* */\n" \
21102  "/* Sortie(s) : OK ou KO */\n" \
21103  "/* */\n" \
21104  "/* Portable : Transparent */\n" \
21105  "/* */\n" \
21106  "/*----------------------------------------------------------------------------*/\n" \
21107  "\n" \
21108  "static int4 givMefCRC(GYBrDOCUMENTEpj* doc, int4 indice)\n" \
21109  "{\n" \
21110  " int4 iCodRet; /* Code retour de la fonction */\n" \
21111  " int4 iIntRet; /* Code retour des appels internes */\n" \
21112  " int1 indFinFetch; /* Indicateur de fin de balayage du curseur */\n" \
21113  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
21114  " int4 i; /* indice de boucle */\n" \
21115  " int4 nb_crc;\n" \
21116  " EXEC SQL\n" \
21117  " begin declare\n" \
21118  " section;\n" \
21119  " GYBrPeCRCT* pvCrc;\n" \
21120  " GYBrIndPeCRCT* pvIndCrc;\n" \
21121  " EXEC SQL\n" \
21122  " end declare\n" \
21123  " section;\n" \
21124  " GWTTrace(GWT_NIV_FONCT, (\"givLectureCRC\\n\"));\n" \
21125  " indice = 0;\n" \
21126  " /* Initialisation du nombre de CRC */\n" \
21127  " nb_crc = 0;\n" \
21128  " iIntRet = givPreparerLectureCRC();\n" \
21129  "\n" \
21130  " if ((int4)GIV::GYBok != iIntRet)\n" \
21131  " {\n" \
21132  " /* Erreur sur prepare curseur SQL */\n" \
21133  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur crsLectureCRC ...\\n\"));\n" \
21134  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
21135  " }\n" \
21136  " else\n" \
21137  " {\n" \
21138  " /* Initialisation des variables locales */\n" \
21139  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
21140  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
21141  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
21142  " /* Valorisation du pointeur vers la structure de description de la table PAYS */\n" \
21143  " pvCrc = &GIVvCrc;\n" \
21144  " pvIndCrc = &GIVvIndCrc;\n" \
21145  " /* Valorisation du pointeur vers la structure de description */\n" \
21146  " /* du tableau de recuperation des crc */\n" \
21147  " (void)memcpy(&pvCrc->acDepart[0], &doc->value.inscription[0].adresse.instal[0], strlen(GIVvInscrip.acDeppar));\n" \
21148  " pvCrc->acDepart[strlen(GIVvInscrip.acDeppar)] = '\\0';\n" \
21149  " (void)strcpy((char*)pvCrc->acNumloc, (const char*)&doc->value.inscription[0].adresse.instal[strlen(GIVvInscrip.acDeppar)]);\n" \
21150  " (void)strcpy((char*)pvCrc->acNumnat, (const char*)GIVvInscrip.acNumnat);\n" \
21151  "\n" \
21152  " for (i = 0; i < nb_an9; i++)\n" \
21153  " {\n" \
21154  " /* rubrique courante */\n" \
21155  " (void)strcpy((char*)pvCrc->acCodan9, (const char*)doc->value.rubriques.Tan9[i].val_codan9);\n" \
21156  " /* Ouverture curseur SQL (car requete type SELECT) */\n" \
21157  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureCRC\");\n" \
21158  " EXEC SQL\n" \
21159  " open crsLectureCRC\n" \
21160  " using :pvCrc->acDepart,\n" \
21161  " :pvCrc->acNumloc,\n" \
21162  " :pvCrc->acNumnat,\n" \
21163  " :pvCrc->acCodan9\n" \
21164  " ;\n" \
21165  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
21166  "\n" \
21167  " if ((int4)GIV::GYBok != iIntRet)\n" \
21168  " {\n" \
21169  " /* Erreur sur declaration curseur SQL */\n" \
21170  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur OPEN crsLectureCRC ...\\n\"));\n" \
21171  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
21172  " }\n" \
21173  " else\n" \
21174  " {\n" \
21175  " /* Execution requete de denombrement (FETCH du curseur) */\n" \
21176  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
21177  "\n" \
21178  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
21179  " {\n" \
21180  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureCRC\");\n" \
21181  " EXEC SQL\n" \
21182  " fetch crsLectureCRC\n" \
21183  " into\n" \
21184  " :pvCrc->acCodCrc\n" \
21185  " :pvIndCrc->sCodCrcI,\n" \
21186  " :pvCrc->acLibCrc:pvIndCrc->sLibCrcI,\n" \
21187  " :pvCrc->acNavCrc:pvIndCrc->sNavCrcI\n" \
21188  " ;\n" \
21189  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
21190  "\n" \
21191  " /* Analyse du code retour SQL */\n" \
21192  " switch (iIntRet)\n" \
21193  " {\n" \
21194  " case (int4)GIV::GYBok:\n" \
21195  " {\n" \
21196  " strcpy(doc->value.crc.trCrc[nb_crc].acCodCrc, GIVvCrc.acCodCrc);\n" \
21197  " strcpy(doc->value.crc.trCrc[nb_crc].acLibCrc, GIVvCrc.acLibCrc);\n" \
21198  " strcpy(doc->value.crc.trCrc[nb_crc].acNavCrc, GIVvCrc.acNavCrc);\n" \
21199  " GWTTrace(GWT_NIV_FONCT, (\" CRC... %s ,%s ,%s\\n\", GIVvCrc.acCodCrc, GIVvCrc.acLibCrc, GIVvCrc.acNavCrc));\n" \
21200  " nb_crc++;\n" \
21201  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
21202  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
21203  " break;\n" \
21204  " }\n" \
21205  "\n" \
21206  " case (int4)GIV::GYBnodata:\n" \
21207  " {\n" \
21208  " /* la localite n'existe pas */\n" \
21209  " /* generer une signalisation */\n" \
21210  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
21211  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
21212  " break;\n" \
21213  " }\n" \
21214  "\n" \
21215  " default:\n" \
21216  " {\n" \
21217  " /* la consultation de la base s'est mal passee */\n" \
21218  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur execute rqtLectureCRC : [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
21219  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
21220  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
21221  " break;\n" \
21222  " }\n" \
21223  " }\n" \
21224  " }\n" \
21225  "\n" \
21226  " /* Fermeture du curseur */\n" \
21227  " (void)strcpy(vErreurSQL.acOrdre_sql, \"close crsLectureCRC\");\n" \
21228  " EXEC SQL\n" \
21229  " close crsLectureCRC;\n" \
21230  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
21231  "\n" \
21232  " if ((int4)GIV::GYBok != iIntRet)\n" \
21233  " {\n" \
21234  " /* Erreur sur fermeture curseur SQL */\n" \
21235  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur CLOSE crsLectureCRC ...\\n\"));\n" \
21236  " }\n" \
21237  "\n" \
21238  " /* an9 suivant */\n" \
21239  " }\n" \
21240  " }\n" \
21241  " }\n" \
21242  "\n" \
21243  " doc->value.crc.iNbCrc = nb_crc;\n" \
21244  " /* Sortie de la fonction */\n" \
21245  " GWTTrace(GWT_NIV_FONCT, (\"GIVLectureCRC\\n\"));\n" \
21246  " /* Sortie de la fonction givMefCRC */\n" \
21247  " return (iCodRet);\n" \
21248  "}\n" \
21249  "\n" \
21250  "/*----Fonction----------------------------------------------------------------*/\n" \
21251  "/* */\n" \
21252  "/* Fonction : givMefPublicite () */\n" \
21253  "/* */\n" \
21254  "/* But : Mise en forme de l'ensemble \"publicite\" */\n" \
21255  "/* */\n" \
21256  "/* */\n" \
21257  "/* */\n" \
21258  "/* Entree(s) : */\n" \
21259  "/* */\n" \
21260  "/* Sortie(s) : OK ou KO */\n" \
21261  "/* */\n" \
21262  "/* Portable : Transparent */\n" \
21263  "/* */\n" \
21264  "/*----------------------------------------------------------------------------*/\n" \
21265  "/* */\n" \
21266  "/* Modification (Nov/14/1997 lgu) : V2 ajout objet 11 micro */\n" \
21267  "/* */\n" \
21268  "/*----------------------------------------------------------------------------*/\n" \
21269  "\n" \
21270  "static int4 givMefPublicite(GYBrDOCUMENTEpj* doc, int4 indice)\n" \
21271  "{\n" \
21272  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
21273  " nat2 usSaveLgMod = 0;\n" \
21274  " /* longueur d'un sous ensemble TLV module */\n" \
21275  " nat2 usSaveLgNoy = 0;\n" \
21276  " /* longueur d'un sous ensemble TLV noyau */\n" \
21277  " nat2 usSaveLgMic = 0; /** -- V2 lgu 14/11/1997 -- */\n" \
21278  " /* longueur d'un sous ensemble TLV objet micro */\n" \
21279  " nat2 usSaveLgEnsMod = 0;\n" \
21280  " /* longueur d'un ensemble TL module */\n" \
21281  " nat2 usSaveLgEnsNoy = 0;\n" \
21282  " /* longueur d'un ensemble TL noyau */\n" \
21283  " nat2 usSaveLgEnsPub = 0;\n" \
21284  " /* longueur d'un ensemble TL publicite */\n" \
21285  " nat2 usSaveLgEnsMic = 0; /** -- V2 lgu 14/11/1997 -- */\n" \
21286  " /* longueur d'un ensemble TL objet micro */\n" \
21287  " nat2 usLgPubTot = 0;\n" \
21288  " /* longueur de travail */\n" \
21289  " int4 giviInsertTLV = 0;\n" \
21290  " /* indice de deplacement dans le tableau de depart */\n" \
21291  " char cTypeObjMicro = 0;\n" \
21292  " /* type d'objet micro *//** -- V2 lgu 27/11/1997 -- */\n" \
21293  " char cNoyauCondense[8 + 1];\n" \
21294  " /* zone receptrice du compactage du numero de noyau */\n" \
21295  " char cModuleCondense[8 + 1];\n" \
21296  " /* zone receptrice du compactage du numero de module */\n" \
21297  " char cMicroCondense[8 + 1]; /** -- V2 lgu 14/11/1997 -- */\n" \
21298  " /* zone receptrice du compactage du numero d'objet micro */\n" \
21299  " char tcType[2 + 1];\n" \
21300  " nb_noyau = 0;\n" \
21301  " nb_micro = 0;\n" \
21302  " nb_module = 0;\n" \
21303  "\n" \
21304  " /* Traitement des noyaux */\n" \
21305  " /**----------------------*/\n" \
21306  " /* N'appeler la mise en forme de l'ensemble de noyaux que s'il existe des noyaux */\n" \
21307  " if (GIV::GIXCodeOK == (int1)GIVcPresenceNoyau)\n" \
21308  " {\n" \
21309  " /* initialiser l'indice de deplacement dans le tableau de depart */\n" \
21310  " giviInsertTLV = 0;\n" \
21311  " GWTTrace(GWT_NIV_FONCT, (\"NOYAU EXISTE : %s\\n\", doc->value.objets_pub.noyau[nb_noyau].type));\n" \
21312  "\n" \
21313  " while (giviInsertTLV < GIViNbTupleIanoy)\n" \
21314  " {\n" \
21315  " /* encodage TLV du type d'objet */\n" \
21316  " doc->value.objets_pub.noyau[nb_noyau].type[0] = givcTypNoyau;\n" \
21317  " GWTTrace(GWT_NIV_FONCT, (\"TYPE : %s\\n\", doc->value.objets_pub.noyau[nb_noyau].type));\n" \
21318  " /* encodage TLV du sous-type d'objet */\n" \
21319  " strcpy(doc->value.objets_pub.noyau[nb_noyau].stype, GIVtrNoyau[giviInsertTLV].acGstaff);\n" \
21320  " GWTTrace(GWT_NIV_FONCT, (\"STYPE : %s\\n\", doc->value.objets_pub.noyau[nb_noyau].stype));\n" \
21321  " /* encodage TLV du numero d'objet (noyau) apres appel de la fonction de compactage */\n" \
21322  " GWCCompacterIdObj(GIVtrNoyau[giviInsertTLV].acNoyau, cNoyauCondense);\n" \
21323  " strcpy(doc->value.objets_pub.noyau[nb_noyau].id, GIVtrNoyau[giviInsertTLV].acNoyau);\n" \
21324  " GWTTrace(GWT_NIV_FONCT, (\"STYPE : %s\\n\", doc->value.objets_pub.noyau[nb_noyau].stype));\n" \
21325  " nb_noyau++;\n" \
21326  " giviInsertTLV++;\n" \
21327  " }\n" \
21328  " }\n" \
21329  "\n" \
21330  " /* traitement des modules */\n" \
21331  " /**-----------------------*/\n" \
21332  " /* N'appeler la mise en forme de l'ensemble de modules que s'il existe des modules */\n" \
21333  " if (GIV::GIXCodeOK == (int1)GIVcPresenceModule)\n" \
21334  " {\n" \
21335  " /* initialiser l'indice de deplacement dans le tableau de depart */\n" \
21336  " giviInsertTLV = 0;\n" \
21337  " GWTTrace(GWT_NIV_FONCT, (\"MODULE EXISTE : %s\\n\", doc->value.objets_pub.module[nb_module].type));\n" \
21338  "\n" \
21339  " while (giviInsertTLV < GIViNbTupleIamod)\n" \
21340  " {\n" \
21341  " /* encodage TLV du type d'objet pour les modules */\n" \
21342  " doc->value.objets_pub.module[nb_module].type[0] = givcTypModule;\n" \
21343  " GWTTrace(GWT_NIV_FONCT, (\"TYPE : %s\\n\", doc->value.objets_pub.module[nb_module].type));\n" \
21344  " /* encodage TLV du sous-type d'objet (type de module) */\n" \
21345  " strcpy(doc->value.objets_pub.module[nb_module].stype, GIVtrModule[giviInsertTLV].acTypmod);\n" \
21346  " GWTTrace(GWT_NIV_FONCT, (\"STYPE : %s\\n\", doc->value.objets_pub.module[nb_module].stype));\n" \
21347  " /* encodage TLV du module apres compactage du numero de module */\n" \
21348  " GWCCompacterIdObj(GIVtrModule[giviInsertTLV].acModule, cModuleCondense);\n" \
21349  " strcpy(doc->value.objets_pub.module[nb_module].id, GIVtrModule[giviInsertTLV].acModule);\n" \
21350  " GWTTrace(GWT_NIV_FONCT, (\"ID_PUB : %s\\n\", doc->value.objets_pub.module[nb_module].id));\n" \
21351  " nb_module++;\n" \
21352  " giviInsertTLV++;\n" \
21353  " }\n" \
21354  " }\n" \
21355  "\n" \
21356  " /** -- V2 lgu 14/11/1997 -- */\n" \
21357  " /* Traitement des objet publicitaire 11 Micro */\n" \
21358  " /**-------------------------------------------*/\n" \
21359  " /* N'appeler la mise en forme de l'ensemble d'objet 11 micro que s'il en existe */\n" \
21360  " if (GIV::GIXCodeOK == (int1)GIVcPresenceObjMicro)\n" \
21361  " {\n" \
21362  " /* initialiser l'indice de deplacement dans le tableau de depart */\n" \
21363  " giviInsertTLV = 0;\n" \
21364  " GWTTrace(GWT_NIV_FONCT, (\"MICRO EXISTE : %s\\n\", doc->value.objets_pub.noyau[nb_micro].type));\n" \
21365  "\n" \
21366  " while (giviInsertTLV < GIViNbTupleIamic)\n" \
21367  " {\n" \
21368  " /* encodage TLV du type d'objet */\n" \
21369  " switch (GIVtrObjMicro[giviInsertTLV].acTypobj[0])\n" \
21370  " {\n" \
21371  " case 'N':\n" \
21372  " cTypeObjMicro = 'C';\n" \
21373  " break;\n" \
21374  "\n" \
21375  " case 'M':\n" \
21376  " cTypeObjMicro = 'X';\n" \
21377  " break;\n" \
21378  "\n" \
21379  " default:\n" \
21380  " cTypeObjMicro = GIVtrObjMicro[giviInsertTLV].acTypobj[0];\n" \
21381  " break;\n" \
21382  " }\n" \
21383  "\n" \
21384  " /* Encodage du type */\n" \
21385  " doc->value.objets_pub.micro[nb_micro].type[0] = cTypeObjMicro;\n" \
21386  " GWTTrace(GWT_NIV_FONCT, (\"TYPE : %s\\n\", doc->value.objets_pub.micro[nb_micro].type));\n" \
21387  " /* encodage TLV de la date d'activation */\n" \
21388  " strcpy(doc->value.objets_pub.micro[nb_micro].tcdatact, GIVtrObjMicro[giviInsertTLV].acDatact);\n" \
21389  " /* type de CVI */\n" \
21390  " doc->value.objets_pub.micro[nb_micro].iCVI = GIVtrObjMicro[giviInsertTLV].iFlagCVI;\n" \
21391  " strcpy(doc->value.objets_pub.micro[nb_micro].stypcvi, GIVtrObjMicro[giviInsertTLV].acTpdcvi);\n" \
21392  " /* encodage TLV du sous-type d'objet */\n" \
21393  " strcpy(doc->value.objets_pub.micro[nb_micro].stype, GIVtrObjMicro[giviInsertTLV].acTpdobj);\n" \
21394  " /* encodage TLV du sous-type interne d'objet */\n" \
21395  " strcpy(doc->value.objets_pub.micro[nb_micro].stypint, GIVtrObjMicro[giviInsertTLV].acTpobint);\n" \
21396  " GWTTrace(GWT_NIV_FONCT, (\"STYPINT : %s\\n\", doc->value.objets_pub.micro[nb_micro].stypint));\n" \
21397  "\n" \
21398  " /* Si sous-type sur un caractère, mettre un blanc devant */\n" \
21399  " if (strlen(doc->value.objets_pub.micro[nb_micro].stype) == 1)\n" \
21400  " {\n" \
21401  " doc->value.objets_pub.micro[nb_micro].stype[1] = doc->value.objets_pub.micro[nb_micro].stype[0];\n" \
21402  " doc->value.objets_pub.micro[nb_micro].stype[0] = ' ';\n" \
21403  " }\n" \
21404  "\n" \
21405  " GWTTrace(GWT_NIV_FONCT, (\"STYPE : %s\\n\", doc->value.objets_pub.micro[nb_micro].stype));\n" \
21406  "\n" \
21407  " /* encodage TLV du sous-sous-type d'objet */\n" \
21408  " /********************* OA11 ******************/\n" \
21409  " if (0 == strlen(GIVtrObjMicro[giviInsertTLV].acStobj))\n" \
21410  " strcpy(doc->value.objets_pub.micro[nb_micro].sstype, doc->value.objets_pub.micro[nb_micro].stype);\n" \
21411  " else\n" \
21412  " strcpy(doc->value.objets_pub.micro[nb_micro].sstype, GIVtrObjMicro[giviInsertTLV].acStobj);\n" \
21413  "\n" \
21414  " doc->value.objets_pub.micro[nb_micro].valeur[0] = '\\0';\n" \
21415  " GWTTrace(GWT_NIV_FONCT, (\"SSTYPE : %s\\n\", doc->value.objets_pub.micro[nb_micro].sstype));\n" \
21416  " GWC_ISO88591_To_MajSansAccent((unsigned char*)doc->value.objets_pub.micro[nb_micro].stype, (unsigned char*)tcType);\n" \
21417  "\n" \
21418  " if (0 == strcmp(doc->value.objets_pub.micro[nb_micro].stype, tcType))\n" \
21419  " {\n" \
21420  " /* encodage TLV du numero d'objet micro apres appel de la fonction de compactage */\n" \
21421  " GWCCompacterIdObj(GIVtrObjMicro[giviInsertTLV].acNumobj, cMicroCondense);\n" \
21422  " strcpy(doc->value.objets_pub.micro[nb_micro].id, GIVtrObjMicro[giviInsertTLV].acNumobj);\n" \
21423  " GWTTrace(GWT_NIV_FONCT, (\"ID : %s\\n\", doc->value.objets_pub.micro[nb_micro].id));\n" \
21424  " nb_micro++;\n" \
21425  " }\n" \
21426  "\n" \
21427  " giviInsertTLV++;\n" \
21428  " }\n" \
21429  "\n" \
21430  " doc->value.objets_pub.nb_micro = nb_micro;\n" \
21431  " }\n" \
21432  "\n" \
21433  " /* Sortie de la fonction */\n" \
21434  " return (iCodRet);\n" \
21435  "}\n" \
21436  "\n" \
21437  "/*----Fonction----------------------------------------------------------------*/\n" \
21438  "/* */\n" \
21439  "/* Fonction : givMefEnsemble () */\n" \
21440  "/* */\n" \
21441  "/* But : Mise en forme de l'ensemble */\n" \
21442  "/* */\n" \
21443  "/* */\n" \
21444  "/* */\n" \
21445  "/* Entree(s) : */\n" \
21446  "/* */\n" \
21447  "/* Sortie(s) : OK ou KO */\n" \
21448  "/* */\n" \
21449  "/* Portable : Transparent */\n" \
21450  "/* */\n" \
21451  "/*----------------------------------------------------------------------------*/\n" \
21452  "/* */\n" \
21453  "/* Modification (Nov/14/1997 lgu) : V2 ajout objet 11 micro */\n" \
21454  "/* */\n" \
21455  "/*----------------------------------------------------------------------------*/\n" \
21456  "\n" \
21457  "static int4 givMefEnsemble(GYBrDOCUMENTEpj* doc, int4 indice)\n" \
21458  "{\n" \
21459  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
21460  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
21461  " int4 i, j, k, q; /* indice boucle doubles */\n" \
21462  " GYBrMouvementsT rMouvement;\n" \
21463  " /* init données de tri en sous-blocs */\n" \
21464  " doc->iIndice = indice;\n" \
21465  " doc->iRang = (int4)0;\n" \
21466  " iCodRet = givMefDonneesGestion(doc, indice);\n" \
21467  " iCodRet = givMefDonneesParution(doc, indice);\n" \
21468  " iCodRet = givMefMoyensTelecom(doc, indice);\n" \
21469  " iCodRet = givMefLieuParution(doc, indice);\n" \
21470  " /* Initialisation du nombre d'An9 */\n" \
21471  " nb_an9 = 0;\n" \
21472  " nb_marque = 0;\n" \
21473  "\n" \
21474  " /* Lecture de la table liens codes AN8 */\n" \
21475  " /* et de la table liens Epj AN8 si IO */\n" \
21476  " if (((-1 != GIVvIndInscrip.sIndprfI) && ('1' == GIVvInscrip.acIndprf[0])) || ((0 == strcmp(\"0000\", doc->value.inscription[0].val_ls)) && ((int4)GIV::GYBok == GIVvIndInscrip.sEtabI)))\n" \
21477  " {\n" \
21478  " rMouvement.copyNumNatLoLs(GIVvInscrip.acNumnat, GIVvInscrip.acNumlo, GIVvInscrip.acNumls);\n" \
21479  " iIntRet = GIVLectureTabIAPROF(&rMouvement);\n" \
21480  "\n" \
21481  " if ((int4)GIV::GIXCodeOK != iIntRet)\n" \
21482  " {\n" \
21483  " /* Echec de la lecture de la table liens codes AN8 */\n" \
21484  " GWTTrace(GWT_NIV_GRAVE, (\"Echec lecture table liens codes AN8 ...\\n\"));\n" \
21485  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
21486  " }\n" \
21487  " }\n" \
21488  " else\n" \
21489  " {\n" \
21490  " GIVcPresenceAn9 = (int1)GIV::GIXCodeKO;\n" \
21491  " GIViNbTupleIaprof = (int4)0;\n" \
21492  " }\n" \
21493  "\n" \
21494  " snprintf(GIVvGeocod.tcQualite, GIVGeocodLgQualite + 1, \"%2d\", GIVGeocodQIgnorer);\n" \
21495  " GIVvGeocod.iStatus = GIVGeocodSEnvRien; /* par défaut rien n'est envoyé au CD */\n" \
21496  " /* toute inscription est géocodée au CG2G */\n" \
21497  " GWTTrace(GWT_NIV_FONCT, (\"Appel de GIVGeocod...\\n\"));\n" \
21498  " GIVGeocod(&GIVvGeocod, GIXcDepartement); /* à partir de IEINSC structure rGeocod */\n" \
21499  " iCodRet = givMefProfessionnel(doc, indice);\n" \
21500  " iCodRet = givMefLieuInstallation(doc, indice);\n" \
21501  " /* géocodage du centre de localité */\n" \
21502  " GIVvGeocod.iStatus = GIVGeocodSEnvRien; /* par défaut rien */\n" \
21503  " strcpy(GIVvGeocod.tcQualite, doc->value.inscription[0].adresse.geoloc.precision);\n" \
21504  " iCodRet = GIVGeoCentreLoc(&GIVvGeocod);\n" \
21505  "\n" \
21506  " if (GIVvGeocod.isStatus(GIVGeocodSEnvXYQ, GIVGeocodSEnvXY))\n" \
21507  " {\n" \
21508  " strcpy(doc->value.inscription[0].adresse.centreloc.precision, GIVvGeocod.tcQualite);\n" \
21509  " GWTTrace(GWT_NIV_FONCT, (\"QUALITE Centre : %s\\n\", doc->value.inscription[0].adresse.centreloc.precision));\n" \
21510  " strcpy(doc->value.inscription[0].adresse.centreloc.precision, \"0\");\n" \
21511  " strcpy(doc->value.inscription[0].adresse.centreloc.longitude, GIVvGeocod.tcLongitude);\n" \
21512  " GWTTrace(GWT_NIV_FONCT, (\"LONGITUDE Centre : %s\\n\", doc->value.inscription[0].adresse.centreloc.longitude));\n" \
21513  " strcpy(doc->value.inscription[0].adresse.centreloc.latitude, GIVvGeocod.tcLatitude);\n" \
21514  " GWTTrace(GWT_NIV_FONCT, (\"LATITUDE Centre : %s\\n\", doc->value.inscription[0].adresse.centreloc.latitude));\n" \
21515  " }\n" \
21516  "\n" \
21517  " /* Initialisation du nombre d'objets publicitaires */\n" \
21518  " nb_noyau = 0;\n" \
21519  " nb_micro = 0;\n" \
21520  " nb_module = 0;\n" \
21521  "\n" \
21522  " if ((GIV::GIXCodeOK == (int1)GIVcPresenceNoyau) || (GIV::GIXCodeOK == (int1)GIVcPresenceModule) || (GIV::GIXCodeOK == (int1)GIVcPresenceObjMicro))\n" \
21523  " iCodRet = givMefPublicite(doc, indice);\n" \
21524  "\n" \
21525  " /* Initialisation du nombre de crc */\n" \
21526  " if (0 != nb_an9)\n" \
21527  " doc->value.crc.iNbCrc = 0;\n" \
21528  "\n" \
21529  " /* anotation de l'intitulé */\n" \
21530  " if (-1 != GIVvIndInscrip.sIntlAnnotI)\n" \
21531  " strcpy(doc->value.intitule.tcIntlAnnot, GIVvInscrip.acIntlAnnot);\n" \
21532  "\n" \
21533  " /* Sortie de la fonction */\n" \
21534  " return (iCodRet);\n" \
21535  "}\n" \
21536  "\n" \
21537  "/*----Fonction----------------------------------------------------------------*/\n" \
21538  "/* */\n" \
21539  "/* Fonction : givMefProfInstal () */\n" \
21540  "/* */\n" \
21541  "/* But : Mise en forme dues associations rub.geo */\n" \
21542  "/* */\n" \
21543  "/* */\n" \
21544  "/* */\n" \
21545  "/* Entree(s) : */\n" \
21546  "/* */\n" \
21547  "/* Sortie(s) : OK ou KO */\n" \
21548  "/* */\n" \
21549  "/* Portable : Transparent */\n" \
21550  "/* */\n" \
21551  "/*----------------------------------------------------------------------------*/\n" \
21552  "/* */\n" \
21553  "/* Modification : */\n" \
21554  "/* */\n" \
21555  "/*----------------------------------------------------------------------------*/\n" \
21556  "\n" \
21557  "static int4 givMefProfInstal(GYBrDOCUMENTEpj* doc, int4 aindice)\n" \
21558  "{\n" \
21559  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
21560  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
21561  " int4 iFusRet = GIV::GWCCodeKO; /* Code retour interne localité fusionnée */\n" \
21562  " int4 i, j, k, l, iIdx = 0; /* Index de boucle */\n" \
21563  " int4 iGeo;\n" \
21564  " int4 iNbrParu, iNbrParuMax, iNbrInst, iNbrInstMax;\n" \
21565  " /* indicateurs de sélection géographique */\n" \
21566  "\n" \
21567  " if ((0 != strlen(doc->value.rubriques.depact)) && (0 != strlen(doc->value.rubriques.locact)))\n" \
21568  " {\n" \
21569  " /* utilisation des données d'activité */\n" \
21570  " strcpy(doc->value.inscription[0].cCoddep, doc->value.rubriques.depact);\n" \
21571  " strcpy(doc->value.inscription[0].cCodloc, doc->value.rubriques.locact);\n" \
21572  " /* arrondissement */\n" \
21573  " strcpy(doc->value.inscription[0].cArrond, doc->value.rubriques.arract);\n" \
21574  " }\n" \
21575  "\n" \
21576  " /* géographie sur première rubrique */\n" \
21577  " for (k = 0 ; ((k < doc->value.rubriques.iNban9) && ('0' != doc->value.rubriques.Tan9[k].recgpp)); k++);\n" \
21578  "\n" \
21579  " if (doc->value.rubriques.iNban9 == k)\n" \
21580  " {\n" \
21581  " /* Sortie de la fonction car tout est réconcilié ! */\n" \
21582  " return (iCodRet);\n" \
21583  " }\n" \
21584  "\n" \
21585  " iNbrParu = givrListParu.iNbr;\n" \
21586  " iNbrInst = givrListInst.iNbr;\n" \
21587  "\n" \
21588  " if ((MAX_LIST == givrListInst.iNbr) || (MAX_LIST == givrListParu.iNbr))\n" \
21589  " {\n" \
21590  " /* Trop d'entrées internes */\n" \
21591  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
21592  " /* Sortie de la fonction */\n" \
21593  " return (iCodRet);\n" \
21594  " }\n" \
21595  "\n" \
21596  " if (0 != strlen(doc->value.inscription[0].cCoddep))\n" \
21597  " {\n" \
21598  " /* arrondissement d'installation */\n" \
21599  " iGeo = givrListInst.iNbr;\n" \
21600  " (void)strcpy(givrListInst.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
21601  " (void)strcpy(givrListInst.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
21602  " (void)strcpy(givrListInst.trEltList[iGeo].dep, doc->value.inscription[0].cCoddep);\n" \
21603  "\n" \
21604  " if (0 != strcmp(givcLocFictive, doc->value.inscription[0].cCodloc))\n" \
21605  " (void)strcpy(givrListInst.trEltList[iGeo].loc, doc->value.inscription[0].cCodloc);\n" \
21606  " else\n" \
21607  " (void)strcpy(givrListInst.trEltList[iGeo].loc, givcLocIndf);\n" \
21608  "\n" \
21609  " (void)strcpy(givrListInst.trEltList[iGeo].arr, doc->value.inscription[0].cArrond);\n" \
21610  " /* région */\n" \
21611  " iIntRet = givLectureTabRegion(doc->value.inscription[0].cCoddep);\n" \
21612  "\n" \
21613  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
21614  " (void)strcpy(givrListInst.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
21615  " else\n" \
21616  " (void)strcpy(givrListInst.trEltList[iGeo].reg, \"99\");\n" \
21617  "\n" \
21618  " (void)strcpy(doc->value.inscription[0].cReg, givrListInst.trEltList[iGeo].reg);\n" \
21619  " (void)strcpy(doc->value.inscription[0].cAncReg, givrListInst.trEltList[iGeo].reg);\n" \
21620  " (void)strcpy(doc->value.inscription[0].cLocFus, \"\");\n" \
21621  " givrListInst.trEltList[iGeo].iRgLigne = aindice;\n" \
21622  " givrListInst.trEltList[iGeo].iGeo = 99;\n" \
21623  " givrListInst.trEltList[iGeo].iGeoReg = 99;\n" \
21624  " givrListInst.trEltList[iGeo].iGeoDept = 99;\n" \
21625  " givrListInst.trEltList[iGeo].iGeoLoc = 99;\n" \
21626  " givrListInst.trEltList[iGeo].iGeoArr = 99;\n" \
21627  " givrListInst.trEltRangList[iGeo] = iGeo;\n" \
21628  " givrListInst.iNbr++;\n" \
21629  "\n" \
21630  " if (0 == strlen(givrListInst.trEltList[iGeo].arr))\n" \
21631  " (void)strcpy(givrListInst.trEltList[iGeo].arr, \"99\");\n" \
21632  "\n" \
21633  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListInst.iNbr))\n" \
21634  " {\n" \
21635  " /* ancienne région */\n" \
21636  " (void)strcpy(doc->value.inscription[0].cAncReg, GIVvRegion.acAncReg);\n" \
21637  " memcpy(&givrListInst.trEltList[iGeo + 1], &givrListInst.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
21638  " strcpy(givrListInst.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
21639  " givrListInst.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
21640  " givrListInst.iNbr++;\n" \
21641  " }\n" \
21642  "\n" \
21643  " /* localité fusionnée */\n" \
21644  " iFusRet = givLectureTabLocFus(doc->value.inscription[0].cCoddep, doc->value.inscription[0].cCodloc);\n" \
21645  "\n" \
21646  " if ((int4)GIV::GIXCodeOK == iFusRet)\n" \
21647  " {\n" \
21648  " if (MAX_LIST == givrListInst.iNbr)\n" \
21649  " {\n" \
21650  " /* Trop d'entrées internes */\n" \
21651  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
21652  " /* Sortie de la fonction */\n" \
21653  " iCodRet = GIV::GWCCodeKO;\n" \
21654  " return (iCodRet);\n" \
21655  " }\n" \
21656  "\n" \
21657  " (void)strcpy(doc->value.inscription[0].cLocFus, GIVvPole.acLocPole);\n" \
21658  " memcpy(&givrListInst.trEltList[givrListInst.iNbr], &givrListInst.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
21659  " (void)strcpy(givrListInst.trEltList[givrListInst.iNbr].dep, GIVvPole.acDepPole);\n" \
21660  " (void)strcpy(givrListInst.trEltList[givrListInst.iNbr].loc, GIVvPole.acLocPole);\n" \
21661  " givrListInst.trEltRangList[givrListInst.iNbr] = givrListInst.iNbr;\n" \
21662  " givrListInst.iNbr++;\n" \
21663  " }\n" \
21664  " }\n" \
21665  " else if ((0 == strlen(doc->value.inscription[0].cCoddep)) && (0 != strcmp(givcDepFictif, doc->value.inscription[0].cDeppar)))\n" \
21666  " {\n" \
21667  " /* arrondisement d'installation */\n" \
21668  " iGeo = givrListInst.iNbr;\n" \
21669  " (void)strcpy(givrListInst.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
21670  " (void)strcpy(givrListInst.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
21671  " (void)strcpy(givrListInst.trEltList[iGeo].dep, doc->value.inscription[0].cDeppar);\n" \
21672  "\n" \
21673  " if (0 != strcmp(givcLocFictive, doc->value.inscription[0].cLocpar))\n" \
21674  " (void)strcpy(givrListInst.trEltList[iGeo].loc, doc->value.inscription[0].cLocpar);\n" \
21675  " else\n" \
21676  " (void)strcpy(givrListInst.trEltList[iGeo].loc, givcLocIndf);\n" \
21677  "\n" \
21678  " (void)strcpy(givrListInst.trEltList[iGeo].arr, doc->value.inscription[0].cArrond);\n" \
21679  " /* région */\n" \
21680  " iIntRet = givLectureTabRegion(doc->value.inscription[0].cDeppar);\n" \
21681  "\n" \
21682  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
21683  " (void)strcpy(givrListInst.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
21684  " else\n" \
21685  " (void)strcpy(givrListInst.trEltList[iGeo].reg, \"99\");\n" \
21686  "\n" \
21687  " (void)strcpy(doc->value.inscription[0].cReg, givrListInst.trEltList[iGeo].reg);\n" \
21688  " (void)strcpy(doc->value.inscription[0].cAncReg, givrListInst.trEltList[iGeo].reg);\n" \
21689  " givrListInst.trEltList[iGeo].iRgLigne = aindice;\n" \
21690  " givrListInst.trEltList[iGeo].iGeo = 99;\n" \
21691  " givrListInst.trEltList[iGeo].iGeoReg = 99;\n" \
21692  " givrListInst.trEltList[iGeo].iGeoDept = 99;\n" \
21693  " givrListInst.trEltList[iGeo].iGeoLoc = 99;\n" \
21694  " givrListInst.trEltList[iGeo].iGeoArr = 99;\n" \
21695  " givrListInst.trEltRangList[iGeo] = iGeo;\n" \
21696  " givrListInst.iNbr++;\n" \
21697  "\n" \
21698  " if (0 == strlen(givrListInst.trEltList[iGeo].arr))\n" \
21699  " (void)strcpy(givrListInst.trEltList[iGeo].arr, \"99\");\n" \
21700  "\n" \
21701  " i = iGeo;\n" \
21702  " GWTTrace(GWT_NIV_FONCT, (\"Installation 1 [%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d]\\n\", givrListInst.trEltList[i].rub, givrListInst.trEltList[i].dep, givrListInst.trEltList[i].loc,\n" \
21703  " givrListInst.trEltList[i].arr, givrListInst.trEltList[i].reg, givrListInst.trEltList[i].iGeoReg, givrListInst.trEltList[i].iGeoDept, givrListInst.trEltList[i].iGeoLoc,\n" \
21704  " givrListInst.trEltList[i].iGeoArr));\n" \
21705  "\n" \
21706  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListInst.iNbr))\n" \
21707  " {\n" \
21708  " /* ancienne région */\n" \
21709  " (void)strcpy(doc->value.inscription[0].cAncReg, GIVvRegion.acAncReg);\n" \
21710  " memcpy(&givrListInst.trEltList[iGeo + 1], &givrListInst.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
21711  " strcpy(givrListInst.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
21712  " givrListInst.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
21713  " givrListInst.iNbr++;\n" \
21714  " }\n" \
21715  "\n" \
21716  " /* localité fusionnée */\n" \
21717  " if (0 != strcmp(givcLocFictive, doc->value.inscription[0].cLocpar))\n" \
21718  " iFusRet = givLectureTabLocFus(doc->value.inscription[0].cDeppar, doc->value.inscription[0].cLocpar);\n" \
21719  "\n" \
21720  " if ((int4)GIV::GIXCodeOK == iFusRet)\n" \
21721  " {\n" \
21722  " if (MAX_LIST == givrListInst.iNbr)\n" \
21723  " {\n" \
21724  " /* Trop d'entrées internes */\n" \
21725  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
21726  " /* Sortie de la fonction */\n" \
21727  " iCodRet = GIV::GWCCodeKO;\n" \
21728  " return (iCodRet);\n" \
21729  " }\n" \
21730  "\n" \
21731  " (void)strcpy(doc->value.inscription[0].cLocFus, GIVvPole.acLocPole);\n" \
21732  " memcpy(&givrListInst.trEltList[givrListInst.iNbr], &givrListInst.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
21733  " (void)strcpy(givrListInst.trEltList[givrListInst.iNbr].dep, GIVvPole.acDepPole);\n" \
21734  " (void)strcpy(givrListInst.trEltList[givrListInst.iNbr].loc, GIVvPole.acLocPole);\n" \
21735  " givrListInst.trEltRangList[givrListInst.iNbr] = givrListInst.iNbr;\n" \
21736  " givrListInst.iNbr++;\n" \
21737  " i = givrListInst.iNbr - 1;\n" \
21738  " GWTTrace(GWT_NIV_FONCT, (\"Installation 2 [%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d]\\n\", givrListInst.trEltList[i].rub, givrListInst.trEltList[i].dep, givrListInst.trEltList[i].loc,\n" \
21739  " givrListInst.trEltList[i].arr, givrListInst.trEltList[i].reg, givrListInst.trEltList[i].iGeoReg, givrListInst.trEltList[i].iGeoDept, givrListInst.trEltList[i].iGeoLoc,\n" \
21740  " givrListInst.trEltList[i].iGeoArr));\n" \
21741  " }\n" \
21742  " }\n" \
21743  "\n" \
21744  " /* arrondisement de parution */\n" \
21745  " iGeo = givrListParu.iNbr;\n" \
21746  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
21747  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
21748  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
21749  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
21750  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
21751  " (void)strcpy(givrListParu.trEltList[iGeo].dep, doc->value.inscription[0].cDeppar);\n" \
21752  " (void)strcpy(givrListParu.trEltList[iGeo].loc, doc->value.inscription[0].cLocpar);\n" \
21753  " (void)strcpy(givrListParu.trEltList[iGeo].arr, doc->value.inscription[0].cArrpar);\n" \
21754  " /* région */\n" \
21755  " iIntRet = givLectureTabRegion(doc->value.inscription[0].cDeppar);\n" \
21756  "\n" \
21757  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
21758  " (void)strcpy(givrListParu.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
21759  " else\n" \
21760  " (void)strcpy(givrListParu.trEltList[iGeo].reg, \"99\");\n" \
21761  "\n" \
21762  " givrListParu.trEltList[iGeo].iDbl = -1;\n" \
21763  " givrListParu.trEltList[iGeo].iRgLigne = aindice;\n" \
21764  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
21765  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
21766  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
21767  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
21768  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
21769  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
21770  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeKO;\n" \
21771  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
21772  " givrListParu.iNbr++;\n" \
21773  "\n" \
21774  " if (0 == strlen(givrListParu.trEltList[iGeo].arr))\n" \
21775  " (void)strcpy(givrListParu.trEltList[iGeo].arr, \"99\");\n" \
21776  "\n" \
21777  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListParu.iNbr))\n" \
21778  " {\n" \
21779  " /* ancienne région */\n" \
21780  " memcpy(&givrListParu.trEltList[iGeo + 1], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
21781  " strcpy(givrListParu.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
21782  " (void)strcpy(givrListParu.trEltList[iGeo + 1].dep, \"999\");\n" \
21783  " (void)strcpy(givrListParu.trEltList[iGeo + 1].loc, \"99999\");\n" \
21784  " (void)strcpy(givrListParu.trEltList[iGeo + 1].arr, \"99\");\n" \
21785  " givrListParu.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
21786  " givrListParu.iNbr++;\n" \
21787  " }\n" \
21788  "\n" \
21789  " if ((0 != strlen(doc->value.inscription[0].cCoddep)) && (0 != strcmp(givcLocFictive, doc->value.inscription[0].cLocpar))\n" \
21790  " && ((0 != strcmp(doc->value.inscription[0].cCodloc, doc->value.inscription[0].cLocpar)) || (0 != strcmp(doc->value.inscription[0].cCoddep, doc->value.inscription[0].cDeppar))))\n" \
21791  " iFusRet = givLectureTabLocFus(doc->value.inscription[0].cDeppar, doc->value.inscription[0].cLocpar);\n" \
21792  "\n" \
21793  " if ((int4)GIV::GIXCodeOK == iFusRet)\n" \
21794  " {\n" \
21795  " if (MAX_LIST == givrListParu.iNbr)\n" \
21796  " {\n" \
21797  " /* Trop d'entrées internes */\n" \
21798  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
21799  " /* Sortie de la fonction */\n" \
21800  " iCodRet = GIV::GWCCodeKO;\n" \
21801  " return (iCodRet);\n" \
21802  " }\n" \
21803  "\n" \
21804  " memcpy(&givrListParu.trEltList[givrListParu.iNbr], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
21805  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].dep, GIVvPole.acDepPole);\n" \
21806  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].loc, GIVvPole.acLocPole);\n" \
21807  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].arr, \"99\");\n" \
21808  " givrListParu.trEltRangList[givrListParu.iNbr] = givrListParu.iNbr;\n" \
21809  " givrListParu.iNbr++;\n" \
21810  " }\n" \
21811  "\n" \
21812  " if ((0 == strcmp(givcLocFictive, doc->value.inscription[0].cLocpar)) && (0 != strcmp(givcLocFictive, doc->value.inscription[0].cCodloc))\n" \
21813  " && (0 == strcmp(doc->value.inscription[0].cCoddep, doc->value.inscription[0].cDeppar)))\n" \
21814  " {\n" \
21815  " /* arrondisement de parution */\n" \
21816  " iGeo = givrListParu.iNbr;\n" \
21817  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
21818  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
21819  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
21820  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
21821  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
21822  " (void)strcpy(givrListParu.trEltList[iGeo].dep, doc->value.inscription[0].cCoddep);\n" \
21823  " (void)strcpy(givrListParu.trEltList[iGeo].loc, doc->value.inscription[0].cCodloc);\n" \
21824  " (void)strcpy(givrListParu.trEltList[iGeo].arr, doc->value.inscription[0].cArrond);\n" \
21825  " /* région */\n" \
21826  " iIntRet = givLectureTabRegion(doc->value.inscription[0].cDeppar);\n" \
21827  "\n" \
21828  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
21829  " (void)strcpy(givrListParu.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
21830  " else\n" \
21831  " (void)strcpy(givrListParu.trEltList[iGeo].reg, \"99\");\n" \
21832  "\n" \
21833  " givrListParu.trEltList[iGeo].iDbl = -1;\n" \
21834  " givrListParu.trEltList[iGeo].iRgLigne = (int4)GIV::GIXCodeKO;\n" \
21835  " givrListParu.trEltList[iGeo].iRgLigne = aindice;\n" \
21836  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
21837  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
21838  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
21839  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
21840  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
21841  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
21842  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeKO;\n" \
21843  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
21844  " givrListParu.iNbr++;\n" \
21845  "\n" \
21846  " if (0 == strlen(givrListParu.trEltList[iGeo].arr))\n" \
21847  " (void)strcpy(givrListParu.trEltList[iGeo].arr, \"99\");\n" \
21848  "\n" \
21849  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListParu.iNbr))\n" \
21850  " {\n" \
21851  " /* ancienne région */\n" \
21852  " memcpy(&givrListParu.trEltList[iGeo + 1], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
21853  " strcpy(givrListParu.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
21854  " (void)strcpy(givrListParu.trEltList[iGeo + 1].dep, \"999\");\n" \
21855  " (void)strcpy(givrListParu.trEltList[iGeo + 1].loc, \"99999\");\n" \
21856  " (void)strcpy(givrListParu.trEltList[iGeo + 1].arr, \"99\");\n" \
21857  " givrListParu.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
21858  " givrListParu.iNbr++;\n" \
21859  " }\n" \
21860  "\n" \
21861  " if ((int4)GIV::GIXCodeOK == iFusRet)\n" \
21862  " {\n" \
21863  " if (MAX_LIST == givrListParu.iNbr)\n" \
21864  " {\n" \
21865  " /* Trop d'entrées internes */\n" \
21866  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
21867  " /* Sortie de la fonction */\n" \
21868  " iCodRet = GIV::GWCCodeKO;\n" \
21869  " return (iCodRet);\n" \
21870  " }\n" \
21871  "\n" \
21872  " memcpy(&givrListParu.trEltList[givrListParu.iNbr], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
21873  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].dep, GIVvPole.acDepPole);\n" \
21874  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].loc, GIVvPole.acLocPole);\n" \
21875  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].arr, \"99\");\n" \
21876  " givrListParu.trEltRangList[givrListParu.iNbr] = givrListParu.iNbr;\n" \
21877  " givrListParu.iNbr++;\n" \
21878  " }\n" \
21879  " }\n" \
21880  "\n" \
21881  " /* Pole de zone urbaine */\n" \
21882  " if (((0 == strlen(doc->value.inscription[0].cCoddep)) && (0 != strcmp(doc->value.inscription[0].cLocpar, givcLocFictive))) || ((0 != strcmp(givcLocFictive, doc->value.inscription[0].cCodloc))\n" \
21883  " && (0 != strlen(doc->value.inscription[0].cCoddep)) && (0 == memcmp(doc->value.inscription[0].cLocpar, doc->value.inscription[0].cCodloc, strlen(doc->value.inscription[0].cCodloc)))\n" \
21884  " && (0 == memcmp(doc->value.inscription[0].cDeppar, doc->value.inscription[0].cCoddep, strlen(doc->value.inscription[0].cCoddep)))))\n" \
21885  " {\n" \
21886  " doc->iGeoLoc = GIV::giv_LOC;\n" \
21887  " iIntRet = givLectureTabZU(doc->value.inscription[0].cDeppar, doc->value.inscription[0].cLocpar);\n" \
21888  "\n" \
21889  " if ((MAX_LIST == givrListParu.iNbr) && ((int4)GIV::GIXCodeOK == iIntRet))\n" \
21890  " {\n" \
21891  " /* Trop d'entrées internes */\n" \
21892  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
21893  " iIntRet = (int4)GIV::GIXCodeKO;\n" \
21894  " }\n" \
21895  "\n" \
21896  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
21897  " {\n" \
21898  " /* pole de parution */\n" \
21899  " iGeo = givrListParu.iNbr;\n" \
21900  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
21901  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
21902  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
21903  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
21904  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
21905  " (void)strcpy(givrListParu.trEltList[iGeo].dep, GIVvPole.acDepPole);\n" \
21906  " (void)strcpy(givrListParu.trEltList[iGeo].loc, GIVvPole.acLocPole);\n" \
21907  " (void)strcpy(givrListParu.trEltList[iGeo].arr, \"00\");\n" \
21908  " /* région */\n" \
21909  " iIntRet = givLectureTabRegion(GIVvPole.acDepPole);\n" \
21910  "\n" \
21911  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
21912  " (void)strcpy(givrListParu.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
21913  " else\n" \
21914  " (void)strcpy(givrListParu.trEltList[iGeo].reg, \"99\");\n" \
21915  "\n" \
21916  " givrListParu.trEltList[iGeo].iDbl = -1;\n" \
21917  " givrListParu.trEltList[iGeo].iRgLigne = aindice;\n" \
21918  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
21919  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
21920  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
21921  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
21922  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
21923  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
21924  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeOK;\n" \
21925  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
21926  " givrListParu.iNbr++;\n" \
21927  "\n" \
21928  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListParu.iNbr))\n" \
21929  " {\n" \
21930  " /* ancienne région */\n" \
21931  " memcpy(&givrListParu.trEltList[iGeo + 1], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
21932  " strcpy(givrListParu.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
21933  " (void)strcpy(givrListParu.trEltList[iGeo + 1].dep, \"999\");\n" \
21934  " (void)strcpy(givrListParu.trEltList[iGeo + 1].loc, \"99999\");\n" \
21935  " (void)strcpy(givrListParu.trEltList[iGeo + 1].arr, \"99\");\n" \
21936  " givrListParu.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
21937  " givrListParu.iNbr++;\n" \
21938  " }\n" \
21939  " }\n" \
21940  " }\n" \
21941  " else\n" \
21942  " {\n" \
21943  " if ((0 == memcmp(doc->value.inscription[0].cDeppar, doc->value.inscription[0].cCoddep, strlen(doc->value.inscription[0].cCoddep))) || (0 == strlen(doc->value.inscription[0].cCoddep)))\n" \
21944  " {\n" \
21945  " if ((0 == strcmp(givcLocFictive, doc->value.inscription[0].cLocpar)) && (0 != strcmp(givcLocFictive, doc->value.inscription[0].cCodloc)) && (0 != strlen(doc->value.inscription[0].cCoddep)))\n" \
21946  " doc->iGeoLoc = GIV::giv_LOC;\n" \
21947  " else if (0 != strcmp(givcDepFictif, doc->value.inscription[0].cDeppar))\n" \
21948  " doc->iGeoLoc = GIV::giv_DEPT;\n" \
21949  " else\n" \
21950  " doc->iGeoLoc = GIV::giv_EXTL;\n" \
21951  "\n" \
21952  " /* pôle de zone urbaine d'installation */\n" \
21953  " iIntRet = givLectureTabZU(doc->value.inscription[0].cDeppar, doc->value.inscription[0].cCodloc);\n" \
21954  "\n" \
21955  " if ((MAX_LIST == givrListParu.iNbr) && ((int4)GIV::GIXCodeOK == iIntRet))\n" \
21956  " {\n" \
21957  " /* Trop d'entrées internes */\n" \
21958  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
21959  " iIntRet = (int4)GIV::GIXCodeKO;\n" \
21960  " }\n" \
21961  "\n" \
21962  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
21963  " {\n" \
21964  " /* pole de parution */\n" \
21965  " iGeo = givrListParu.iNbr;\n" \
21966  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
21967  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
21968  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
21969  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
21970  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
21971  " (void)strcpy(givrListParu.trEltList[iGeo].dep, GIVvPole.acDepPole);\n" \
21972  " (void)strcpy(givrListParu.trEltList[iGeo].loc, GIVvPole.acLocPole);\n" \
21973  " (void)strcpy(givrListParu.trEltList[iGeo].arr, \"00\");\n" \
21974  " /* région */\n" \
21975  " iIntRet = givLectureTabRegion(GIVvPole.acDepPole);\n" \
21976  "\n" \
21977  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
21978  " (void)strcpy(givrListParu.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
21979  " else\n" \
21980  " (void)strcpy(givrListParu.trEltList[iGeo].reg, \"99\");\n" \
21981  "\n" \
21982  " givrListParu.trEltList[iGeo].iDbl = -1;\n" \
21983  " givrListParu.trEltList[iGeo].iRgLigne = aindice;\n" \
21984  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
21985  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
21986  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
21987  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
21988  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
21989  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
21990  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeOK;\n" \
21991  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
21992  " givrListParu.iNbr++;\n" \
21993  "\n" \
21994  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListParu.iNbr))\n" \
21995  " {\n" \
21996  " /* ancienne région */\n" \
21997  " memcpy(&givrListParu.trEltList[iGeo + 1], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
21998  " strcpy(givrListParu.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
21999  " (void)strcpy(givrListParu.trEltList[iGeo + 1].dep, \"999\");\n" \
22000  " (void)strcpy(givrListParu.trEltList[iGeo + 1].loc, \"99999\");\n" \
22001  " (void)strcpy(givrListParu.trEltList[iGeo + 1].arr, \"99\");\n" \
22002  " givrListParu.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
22003  " givrListParu.iNbr++;\n" \
22004  " }\n" \
22005  "\n" \
22006  " if (MAX_LIST == givrListParu.iNbr)\n" \
22007  " {\n" \
22008  " /* Trop d'entrées internes */\n" \
22009  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
22010  " }\n" \
22011  " else if ((0 == strcmp(givcLocFictive, doc->value.inscription[0].cLocpar)) && (0 != strcmp(givcLocFictive, doc->value.inscription[0].cCodloc)) && (0 != strlen(doc->value.inscription[0].cCoddep))\n" \
22012  " && (0 == strcmp(doc->value.inscription[0].cDeppar, doc->value.inscription[0].cCoddep)) && (0 == strcmp(doc->value.inscription[0].cDeppar, GIVvPole.acDepPole)))\n" \
22013  " {\n" \
22014  " GWTTrace(GWT_NIV_FONCT, (\"ZU et LF : %s,%s,%s,%s,%s,%s\\n\", doc->value.inscription[0].cLocpar, doc->value.inscription[0].cDeppar, doc->value.inscription[0].cCoddep, doc->value.inscription[0].cCodloc,\n" \
22015  " GIVvPole.acDepPole, GIVvPole.acLocPole));\n" \
22016  " /* implicitement parution sur le pôle */\n" \
22017  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].rub, givrListParu.trEltList[iGeo].rub);\n" \
22018  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].rubinit, givrListParu.trEltList[iGeo].rubinit);\n" \
22019  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].nature, givrListParu.trEltList[iGeo].nature);\n" \
22020  " givrListParu.trEltList[givrListParu.iNbr].orig = givrListParu.trEltList[iGeo].orig;\n" \
22021  " givrListParu.trEltList[givrListParu.iNbr].cParuloc = givrListParu.trEltList[iGeo].cParuloc;\n" \
22022  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].dep, GIVvPole.acDepPole);\n" \
22023  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].loc, GIVvPole.acLocPole);\n" \
22024  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].arr, \"00\");\n" \
22025  "\n" \
22026  " /* région */\n" \
22027  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22028  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].reg, GIVvRegion.acRegion);\n" \
22029  " else\n" \
22030  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].reg, \"99\");\n" \
22031  "\n" \
22032  " givrListParu.trEltList[givrListParu.iNbr].iDbl = -1;\n" \
22033  " givrListParu.trEltList[givrListParu.iNbr].iRgLigne = aindice;\n" \
22034  " givrListParu.trEltList[givrListParu.iNbr].iGeo = 99;\n" \
22035  " givrListParu.trEltList[givrListParu.iNbr].iGeoReg = 99;\n" \
22036  " givrListParu.trEltList[givrListParu.iNbr].iGeoDept = 99;\n" \
22037  " givrListParu.trEltList[givrListParu.iNbr].iGeoLoc = 99;\n" \
22038  " givrListParu.trEltList[givrListParu.iNbr].iGeoArr = 99;\n" \
22039  " givrListParu.trEltList[givrListParu.iNbr].iLF = (int4)GIV::GIXCodeKO;\n" \
22040  " givrListParu.trEltList[givrListParu.iNbr].iZU = (int4)GIV::GIXCodeKO;\n" \
22041  " givrListParu.trEltRangList[givrListParu.iNbr] = givrListParu.iNbr;\n" \
22042  " givrListParu.iNbr++;\n" \
22043  " }\n" \
22044  " }\n" \
22045  " }\n" \
22046  " else\n" \
22047  " {\n" \
22048  " doc->iGeoLoc = GIV::giv_EXTL;\n" \
22049  "\n" \
22050  " if (0 != strlen(doc->value.inscription[0].cCoddep))\n" \
22051  " {\n" \
22052  " /* pôle de zone urbaine d'installation */\n" \
22053  " iIntRet = givLectureTabZU(doc->value.inscription[0].cCoddep, doc->value.inscription[0].cCodloc);\n" \
22054  "\n" \
22055  " if ((MAX_LIST == givrListParu.iNbr) && ((int4)GIV::GIXCodeOK == iIntRet))\n" \
22056  " {\n" \
22057  " /* Trop d'entrées internes */\n" \
22058  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
22059  " iIntRet = (int4)GIV::GIXCodeKO;\n" \
22060  " }\n" \
22061  "\n" \
22062  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22063  " {\n" \
22064  " /* pole de parution */\n" \
22065  " iGeo = givrListParu.iNbr;\n" \
22066  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
22067  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
22068  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
22069  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
22070  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
22071  " (void)strcpy(givrListParu.trEltList[iGeo].dep, GIVvPole.acDepPole);\n" \
22072  " (void)strcpy(givrListParu.trEltList[iGeo].loc, GIVvPole.acLocPole);\n" \
22073  " (void)strcpy(givrListParu.trEltList[iGeo].arr, \"00\");\n" \
22074  " /* région */\n" \
22075  " iIntRet = givLectureTabRegion(GIVvPole.acDepPole);\n" \
22076  "\n" \
22077  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22078  " (void)strcpy(givrListParu.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
22079  " else\n" \
22080  " (void)strcpy(givrListParu.trEltList[iGeo].reg, \"99\");\n" \
22081  "\n" \
22082  " givrListParu.trEltList[iGeo].iDbl = -1;\n" \
22083  " givrListParu.trEltList[iGeo].iRgLigne = aindice;\n" \
22084  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
22085  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
22086  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
22087  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
22088  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
22089  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
22090  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeOK;\n" \
22091  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
22092  " givrListParu.iNbr++;\n" \
22093  "\n" \
22094  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListParu.iNbr))\n" \
22095  " {\n" \
22096  " /* ancienne région */\n" \
22097  " memcpy(&givrListParu.trEltList[iGeo + 1], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
22098  " strcpy(givrListParu.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
22099  " (void)strcpy(givrListParu.trEltList[iGeo + 1].dep, \"999\");\n" \
22100  " (void)strcpy(givrListParu.trEltList[iGeo + 1].loc, \"99999\");\n" \
22101  " (void)strcpy(givrListParu.trEltList[iGeo + 1].arr, \"99\");\n" \
22102  " givrListParu.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
22103  " givrListParu.iNbr++;\n" \
22104  " }\n" \
22105  " }\n" \
22106  " }\n" \
22107  " }\n" \
22108  " }\n" \
22109  "\n" \
22110  " GWTTrace(GWT_NIV_FONCT, (\"GeoLoc : %d\\n\", doc->value.rubriques.iNban9));\n" \
22111  " /* géographie sur rubriques suivantes */\n" \
22112  " iNbrInstMax = givrListInst.iNbr - iNbrInst;\n" \
22113  " iNbrParuMax = givrListParu.iNbr - iNbrParu;\n" \
22114  "\n" \
22115  " for (k = k + 1 ; k < doc->value.rubriques.iNban9; k++)\n" \
22116  " {\n" \
22117  " if ('0' != doc->value.rubriques.Tan9[k].recgpp)\n" \
22118  " {\n" \
22119  " /* rubrique réconciliée */\n" \
22120  " continue;\n" \
22121  " }\n" \
22122  "\n" \
22123  " for (l = 0; l < iNbrInstMax; l++)\n" \
22124  " {\n" \
22125  " iGeo = givrListInst.iNbr;\n" \
22126  "\n" \
22127  " if (MAX_LIST == iGeo)\n" \
22128  " {\n" \
22129  " /* Trop d'entrées internes */\n" \
22130  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
22131  " break;\n" \
22132  " }\n" \
22133  "\n" \
22134  " (void)strcpy(givrListInst.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
22135  " (void)strcpy(givrListInst.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
22136  " (void)strcpy(givrListInst.trEltList[iGeo].dep, givrListInst.trEltList[iNbrInst + l].dep);\n" \
22137  " (void)strcpy(givrListInst.trEltList[iGeo].loc, givrListInst.trEltList[iNbrInst + l].loc);\n" \
22138  " (void)strcpy(givrListInst.trEltList[iGeo].arr, givrListInst.trEltList[iNbrInst + l].arr);\n" \
22139  " (void)strcpy(givrListInst.trEltList[iGeo].reg, givrListInst.trEltList[iNbrInst + l].reg);\n" \
22140  " givrListInst.trEltList[iGeo].iRgLigne = givrListInst.trEltList[iNbrInst + l].iRgLigne;\n" \
22141  " givrListInst.trEltList[iGeo].iGeo = 99;\n" \
22142  " givrListInst.trEltList[iGeo].iGeoReg = 99;\n" \
22143  " givrListInst.trEltList[iGeo].iGeoDept = 99;\n" \
22144  " givrListInst.trEltList[iGeo].iGeoLoc = 99;\n" \
22145  " givrListInst.trEltList[iGeo].iGeoArr = 99;\n" \
22146  " givrListInst.trEltRangList[iGeo] = iGeo;\n" \
22147  " givrListInst.iNbr++;\n" \
22148  " }\n" \
22149  "\n" \
22150  " GWTTrace(GWT_NIV_FONCT, (\"ParuLoc 0: %c\\n\", doc->value.rubriques.Tan9[k].paru));\n" \
22151  "\n" \
22152  " for (l = 0; l < iNbrParuMax; l++)\n" \
22153  " {\n" \
22154  " iGeo = givrListParu.iNbr;\n" \
22155  "\n" \
22156  " if (MAX_LIST == iGeo)\n" \
22157  " {\n" \
22158  " /* Trop d'entrées internes */\n" \
22159  " GWTTrace(GWT_NIV_GRAVE, (\"Taille liste interne dépassée\\n\"));\n" \
22160  " break;\n" \
22161  " }\n" \
22162  "\n" \
22163  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
22164  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
22165  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
22166  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
22167  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
22168  " GWTTrace(GWT_NIV_FONCT, (\"ParuLoc 1: %c\\n\", givrListParu.trEltList[iGeo].cParuloc));\n" \
22169  " (void)strcpy(givrListParu.trEltList[iGeo].dep, givrListParu.trEltList[iNbrParu + l].dep);\n" \
22170  " (void)strcpy(givrListParu.trEltList[iGeo].loc, givrListParu.trEltList[iNbrParu + l].loc);\n" \
22171  " (void)strcpy(givrListParu.trEltList[iGeo].arr, givrListParu.trEltList[iNbrParu + l].arr);\n" \
22172  " (void)strcpy(givrListParu.trEltList[iGeo].reg, givrListParu.trEltList[iNbrParu + l].reg);\n" \
22173  " givrListParu.trEltList[iGeo].iDbl = givrListParu.trEltList[iNbrParu + l].iDbl;\n" \
22174  " givrListParu.trEltList[iGeo].iRgLigne = givrListParu.trEltList[iNbrParu + l].iRgLigne;\n" \
22175  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
22176  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
22177  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
22178  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
22179  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
22180  " givrListParu.trEltList[iGeo].iZU = givrListParu.trEltList[iNbrParu + l].iZU;\n" \
22181  " givrListParu.trEltList[iGeo].iLF = givrListParu.trEltList[iNbrParu + l].iLF;\n" \
22182  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
22183  " givrListParu.iNbr++;\n" \
22184  " }\n" \
22185  " }\n" \
22186  "\n" \
22187  " GWTTrace(GWT_NIV_FONCT, (\"GeoLoc : %d\\n\", doc->iGeoLoc));\n" \
22188  " GWTTrace(GWT_NIV_FONCT, (\" Doubles %d,%d\\n\", givrListInst.iNbr, givrListParu.iNbr));\n" \
22189  " /* Sortie de la fonction */\n" \
22190  " return (iCodRet);\n" \
22191  "}\n" \
22192  "\n" \
22193  "/*----Fonction----------------------------------------------------------------*/\n" \
22194  "/* */\n" \
22195  "/* Fonction : givMefProfParu () */\n" \
22196  "/* */\n" \
22197  "/* But : Mise en forme des parutions rub.geo */\n" \
22198  "/* */\n" \
22199  "/* */\n" \
22200  "/* */\n" \
22201  "/* Entree(s) : */\n" \
22202  "/* */\n" \
22203  "/* Sortie(s) : OK ou KO */\n" \
22204  "/* */\n" \
22205  "/* Portable : Transparent */\n" \
22206  "/* */\n" \
22207  "/*----------------------------------------------------------------------------*/\n" \
22208  "/* */\n" \
22209  "/* Modification : */\n" \
22210  "/* */\n" \
22211  "/*----------------------------------------------------------------------------*/\n" \
22212  "\n" \
22213  "extern int4 GIVMefProfParu(GYBrIaparuT* apIaparu, int4 aiDbl, int4 aiRef)\n" \
22214  "{\n" \
22215  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
22216  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
22217  " int4 k = 0; /* Index de boucle */\n" \
22218  " int4 iGeo, iIndice;\n" \
22219  " GYBrDOCUMENTEpj rDoc;\n" \
22220  " GYBrDOCUMENTEpj* doc;\n" \
22221  " /* indicateurs de sélection géographique */\n" \
22222  " doc = &rDoc;\n" \
22223  " (void)strcpy(doc->value.inscription[0].cDeppar, apIaparu->acDeppar);\n" \
22224  " (void)strcpy(doc->value.inscription[0].cLocpar, apIaparu->acLocpar);\n" \
22225  " (void)strcpy(doc->value.inscription[0].cArrpar, apIaparu->acArrpar);\n" \
22226  " (void)strcpy(doc->value.inscription[0].cCoddep, givrListInst.trEltList[aiRef].dep);\n" \
22227  " (void)strcpy(doc->value.inscription[0].cCodloc, givrListInst.trEltList[aiRef].loc);\n" \
22228  " (void)strcpy(doc->value.inscription[0].cArrond, givrListInst.trEltList[aiRef].arr);\n" \
22229  " (void)strcpy(doc->value.rubriques.Tan9[0].val_codan9, givrListParu.trEltList[aiRef].rub);\n" \
22230  " (void)strcpy(doc->value.rubriques.Tan9[0].val_codan8, givrListParu.trEltList[aiRef].rubinit);\n" \
22231  " (void)strcpy(doc->value.rubriques.Tan9[0].nature, givrListParu.trEltList[aiRef].nature);\n" \
22232  " doc->value.rubriques.Tan9[0].orig = givrListParu.trEltList[aiRef].orig;\n" \
22233  " doc->value.rubriques.Tan9[0].paru = givrListParu.trEltList[aiRef].cParuloc;\n" \
22234  " /* géographie sur première rubrique */\n" \
22235  " k = 0;\n" \
22236  " iIndice = 0;\n" \
22237  " /* arrondisement de parution */\n" \
22238  " iGeo = givrListParu.iNbr;\n" \
22239  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
22240  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
22241  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
22242  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
22243  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
22244  " (void)strcpy(givrListParu.trEltList[iGeo].dep, doc->value.inscription[0].cDeppar);\n" \
22245  " (void)strcpy(givrListParu.trEltList[iGeo].loc, doc->value.inscription[0].cLocpar);\n" \
22246  " (void)strcpy(givrListParu.trEltList[iGeo].arr, doc->value.inscription[0].cArrpar);\n" \
22247  " /* région */\n" \
22248  " iIntRet = givLectureTabRegion(doc->value.inscription[0].cDeppar);\n" \
22249  "\n" \
22250  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22251  " (void)strcpy(givrListParu.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
22252  " else\n" \
22253  " (void)strcpy(givrListParu.trEltList[iGeo].reg, \"99\");\n" \
22254  "\n" \
22255  " givrListParu.trEltList[iGeo].iDbl = aiDbl;\n" \
22256  " givrListParu.trEltList[iGeo].iRgLigne = iIndice;\n" \
22257  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
22258  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
22259  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
22260  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
22261  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
22262  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
22263  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeKO;\n" \
22264  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
22265  " givrListParu.iNbr++;\n" \
22266  "\n" \
22267  " if (0 == strlen(givrListParu.trEltList[iGeo].arr))\n" \
22268  " (void)strcpy(givrListParu.trEltList[iGeo].arr, \"99\");\n" \
22269  "\n" \
22270  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListParu.iNbr))\n" \
22271  " {\n" \
22272  " /* ancienne région */\n" \
22273  " memcpy(&givrListParu.trEltList[iGeo + 1], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
22274  " strcpy(givrListParu.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
22275  " (void)strcpy(givrListParu.trEltList[iGeo + 1].dep, \"999\");\n" \
22276  " (void)strcpy(givrListParu.trEltList[iGeo + 1].loc, \"99999\");\n" \
22277  " (void)strcpy(givrListParu.trEltList[iGeo + 1].arr, \"99\");\n" \
22278  " givrListParu.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
22279  " givrListParu.iNbr++;\n" \
22280  " }\n" \
22281  "\n" \
22282  " if ((0 == strcmp(givcLocFictive, doc->value.inscription[0].cLocpar)) && (0 != strcmp(givcLocFictive, doc->value.inscription[0].cCodloc))\n" \
22283  " && (0 == strcmp(doc->value.inscription[0].cCoddep, doc->value.inscription[0].cDeppar)))\n" \
22284  " {\n" \
22285  " /* arrondisement de parution */\n" \
22286  " iGeo = givrListParu.iNbr;\n" \
22287  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
22288  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
22289  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
22290  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
22291  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
22292  " (void)strcpy(givrListParu.trEltList[iGeo].dep, doc->value.inscription[0].cCoddep);\n" \
22293  " (void)strcpy(givrListParu.trEltList[iGeo].loc, doc->value.inscription[0].cCodloc);\n" \
22294  " (void)strcpy(givrListParu.trEltList[iGeo].arr, doc->value.inscription[0].cArrond);\n" \
22295  " /* région */\n" \
22296  " iIntRet = givLectureTabRegion(doc->value.inscription[0].cDeppar);\n" \
22297  "\n" \
22298  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22299  " (void)strcpy(givrListParu.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
22300  " else\n" \
22301  " (void)strcpy(givrListParu.trEltList[iGeo].reg, \"99\");\n" \
22302  "\n" \
22303  " givrListParu.trEltList[iGeo].iDbl = aiDbl;\n" \
22304  " givrListParu.trEltList[iGeo].iRgLigne = (int4)GIV::GIXCodeKO;\n" \
22305  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
22306  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
22307  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
22308  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
22309  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
22310  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
22311  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeKO;\n" \
22312  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
22313  " givrListParu.iNbr++;\n" \
22314  "\n" \
22315  " if (0 == strlen(givrListParu.trEltList[iGeo].arr))\n" \
22316  " (void)strcpy(givrListParu.trEltList[iGeo].arr, \"99\");\n" \
22317  "\n" \
22318  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListParu.iNbr))\n" \
22319  " {\n" \
22320  " /* ancienne région */\n" \
22321  " memcpy(&givrListParu.trEltList[iGeo + 1], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
22322  " strcpy(givrListParu.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
22323  " (void)strcpy(givrListParu.trEltList[iGeo + 1].dep, \"999\");\n" \
22324  " (void)strcpy(givrListParu.trEltList[iGeo + 1].loc, \"99999\");\n" \
22325  " (void)strcpy(givrListParu.trEltList[iGeo + 1].arr, \"99\");\n" \
22326  " givrListParu.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
22327  " givrListParu.iNbr++;\n" \
22328  " }\n" \
22329  " }\n" \
22330  "\n" \
22331  " /* Pole de zone urbaine */\n" \
22332  " if (((0 == strlen(doc->value.inscription[0].cCoddep)) && (0 != strcmp(doc->value.inscription[0].cLocpar, givcLocFictive))) || ((0 != strcmp(givcLocFictive, doc->value.inscription[0].cCodloc))\n" \
22333  " && (0 != strlen(doc->value.inscription[0].cCoddep)) && (0 == memcmp(doc->value.inscription[0].cLocpar, doc->value.inscription[0].cCodloc, strlen(doc->value.inscription[0].cCodloc)))\n" \
22334  " && (0 == memcmp(doc->value.inscription[0].cDeppar, doc->value.inscription[0].cCoddep, strlen(doc->value.inscription[0].cCoddep)))))\n" \
22335  " {\n" \
22336  " doc->iGeoLoc = GIV::giv_LOC;\n" \
22337  " iIntRet = givLectureTabZU(doc->value.inscription[0].cDeppar, doc->value.inscription[0].cLocpar);\n" \
22338  "\n" \
22339  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22340  " {\n" \
22341  " /* pole de parution */\n" \
22342  " iGeo = givrListParu.iNbr;\n" \
22343  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
22344  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
22345  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
22346  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
22347  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
22348  " (void)strcpy(givrListParu.trEltList[iGeo].dep, GIVvPole.acDepPole);\n" \
22349  " (void)strcpy(givrListParu.trEltList[iGeo].loc, GIVvPole.acLocPole);\n" \
22350  " (void)strcpy(givrListParu.trEltList[iGeo].arr, \"00\");\n" \
22351  " /* région */\n" \
22352  " iIntRet = givLectureTabRegion(GIVvPole.acDepPole);\n" \
22353  "\n" \
22354  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22355  " (void)strcpy(givrListParu.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
22356  " else\n" \
22357  " (void)strcpy(givrListParu.trEltList[iGeo].reg, \"99\");\n" \
22358  "\n" \
22359  " givrListParu.trEltList[iGeo].iDbl = aiDbl;\n" \
22360  " givrListParu.trEltList[iGeo].iRgLigne = iIndice;\n" \
22361  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
22362  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
22363  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
22364  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
22365  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
22366  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
22367  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeOK;\n" \
22368  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
22369  " givrListParu.iNbr++;\n" \
22370  "\n" \
22371  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListParu.iNbr))\n" \
22372  " {\n" \
22373  " /* ancienne région */\n" \
22374  " memcpy(&givrListParu.trEltList[iGeo + 1], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
22375  " strcpy(givrListParu.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
22376  " (void)strcpy(givrListParu.trEltList[iGeo + 1].dep, \"999\");\n" \
22377  " (void)strcpy(givrListParu.trEltList[iGeo + 1].loc, \"99999\");\n" \
22378  " (void)strcpy(givrListParu.trEltList[iGeo + 1].arr, \"99\");\n" \
22379  " givrListParu.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
22380  " givrListParu.iNbr++;\n" \
22381  " }\n" \
22382  " }\n" \
22383  " }\n" \
22384  " else\n" \
22385  " {\n" \
22386  " if ((0 == memcmp(doc->value.inscription[0].cDeppar, doc->value.inscription[0].cCoddep, strlen(doc->value.inscription[0].cCoddep))) || (0 == strlen(doc->value.inscription[0].cCoddep)))\n" \
22387  " {\n" \
22388  " if ((0 == strcmp(givcLocFictive, doc->value.inscription[0].cLocpar)) && (0 != strcmp(givcLocFictive, doc->value.inscription[0].cCodloc)) && (0 != strlen(doc->value.inscription[0].cCoddep)))\n" \
22389  " doc->iGeoLoc = GIV::giv_LOC;\n" \
22390  " else if (0 != strcmp(givcDepFictif, doc->value.inscription[0].cDeppar))\n" \
22391  " doc->iGeoLoc = GIV::giv_DEPT;\n" \
22392  " else\n" \
22393  " doc->iGeoLoc = GIV::giv_EXTL;\n" \
22394  "\n" \
22395  " /* pôle de zone urbaine d'installation */\n" \
22396  " iIntRet = givLectureTabZU(doc->value.inscription[0].cDeppar, doc->value.inscription[0].cCodloc);\n" \
22397  "\n" \
22398  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22399  " {\n" \
22400  " /* pole de parution */\n" \
22401  " iGeo = givrListParu.iNbr;\n" \
22402  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
22403  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
22404  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
22405  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
22406  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
22407  " (void)strcpy(givrListParu.trEltList[iGeo].dep, GIVvPole.acDepPole);\n" \
22408  " (void)strcpy(givrListParu.trEltList[iGeo].loc, GIVvPole.acLocPole);\n" \
22409  " (void)strcpy(givrListParu.trEltList[iGeo].arr, \"00\");\n" \
22410  " /* région */\n" \
22411  " iIntRet = givLectureTabRegion(GIVvPole.acDepPole);\n" \
22412  "\n" \
22413  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22414  " (void)strcpy(givrListParu.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
22415  " else\n" \
22416  " (void)strcpy(givrListParu.trEltList[iGeo].reg, \"99\");\n" \
22417  "\n" \
22418  " givrListParu.trEltList[iGeo].iDbl = aiDbl;\n" \
22419  " givrListParu.trEltList[iGeo].iRgLigne = iIndice;\n" \
22420  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
22421  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
22422  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
22423  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
22424  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
22425  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
22426  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeOK;\n" \
22427  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
22428  " givrListParu.iNbr++;\n" \
22429  "\n" \
22430  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListParu.iNbr))\n" \
22431  " {\n" \
22432  " /* ancienne région */\n" \
22433  " memcpy(&givrListParu.trEltList[iGeo + 1], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
22434  " strcpy(givrListParu.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
22435  " (void)strcpy(givrListParu.trEltList[iGeo + 1].dep, \"999\");\n" \
22436  " (void)strcpy(givrListParu.trEltList[iGeo + 1].loc, \"99999\");\n" \
22437  " (void)strcpy(givrListParu.trEltList[iGeo + 1].arr, \"99\");\n" \
22438  " givrListParu.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
22439  " givrListParu.iNbr++;\n" \
22440  " }\n" \
22441  "\n" \
22442  " if ((0 == strcmp(givcLocFictive, doc->value.inscription[0].cLocpar)) && (0 != strcmp(givcLocFictive, doc->value.inscription[0].cCodloc)) && (0 != strlen(doc->value.inscription[0].cCoddep)))\n" \
22443  " {\n" \
22444  " /* implicitement parution sur le pôle */\n" \
22445  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].rub, givrListParu.trEltList[iGeo].rub);\n" \
22446  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].rubinit, givrListParu.trEltList[iGeo].rubinit);\n" \
22447  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].nature, givrListParu.trEltList[iGeo].nature);\n" \
22448  " givrListParu.trEltList[givrListParu.iNbr].orig = givrListParu.trEltList[iGeo].orig;\n" \
22449  " givrListParu.trEltList[givrListParu.iNbr].cParuloc = givrListParu.trEltList[iGeo].cParuloc;\n" \
22450  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].dep, GIVvPole.acDepPole);\n" \
22451  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].loc, GIVvPole.acLocPole);\n" \
22452  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].arr, \"00\");\n" \
22453  "\n" \
22454  " /* région */\n" \
22455  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22456  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].reg, GIVvRegion.acRegion);\n" \
22457  " else\n" \
22458  " (void)strcpy(givrListParu.trEltList[givrListParu.iNbr].reg, \"99\");\n" \
22459  "\n" \
22460  " givrListParu.trEltList[givrListParu.iNbr].iDbl = aiDbl;\n" \
22461  " givrListParu.trEltList[givrListParu.iNbr].iRgLigne = iIndice;\n" \
22462  " givrListParu.trEltList[givrListParu.iNbr].iGeo = 99;\n" \
22463  " givrListParu.trEltList[givrListParu.iNbr].iGeoReg = 99;\n" \
22464  " givrListParu.trEltList[givrListParu.iNbr].iGeoDept = 99;\n" \
22465  " givrListParu.trEltList[givrListParu.iNbr].iGeoLoc = 99;\n" \
22466  " givrListParu.trEltList[givrListParu.iNbr].iGeoArr = 99;\n" \
22467  " givrListParu.trEltList[givrListParu.iNbr].iLF = (int4)GIV::GIXCodeKO;\n" \
22468  " givrListParu.trEltList[givrListParu.iNbr].iZU = (int4)GIV::GIXCodeKO;\n" \
22469  " givrListParu.trEltRangList[givrListParu.iNbr] = givrListParu.iNbr;\n" \
22470  " givrListParu.iNbr++;\n" \
22471  " }\n" \
22472  " }\n" \
22473  " }\n" \
22474  " else\n" \
22475  " {\n" \
22476  " doc->iGeoLoc = GIV::giv_EXTL;\n" \
22477  "\n" \
22478  " if (0 != strlen(doc->value.inscription[0].cCoddep))\n" \
22479  " {\n" \
22480  " /* pôle de zone urbaine d'installation */\n" \
22481  " iIntRet = givLectureTabZU(doc->value.inscription[0].cCoddep, doc->value.inscription[0].cCodloc);\n" \
22482  "\n" \
22483  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22484  " {\n" \
22485  " /* pole de parution */\n" \
22486  " iGeo = givrListParu.iNbr;\n" \
22487  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
22488  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
22489  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
22490  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
22491  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
22492  " (void)strcpy(givrListParu.trEltList[iGeo].dep, GIVvPole.acDepPole);\n" \
22493  " (void)strcpy(givrListParu.trEltList[iGeo].loc, GIVvPole.acLocPole);\n" \
22494  " (void)strcpy(givrListParu.trEltList[iGeo].arr, \"00\");\n" \
22495  " /* région */\n" \
22496  " iIntRet = givLectureTabRegion(GIVvPole.acDepPole);\n" \
22497  "\n" \
22498  " if ((int4)GIV::GIXCodeOK == iIntRet)\n" \
22499  " (void)strcpy(givrListParu.trEltList[iGeo].reg, GIVvRegion.acRegion);\n" \
22500  " else\n" \
22501  " (void)strcpy(givrListParu.trEltList[iGeo].reg, \"99\");\n" \
22502  "\n" \
22503  " givrListParu.trEltList[iGeo].iDbl = aiDbl;\n" \
22504  " givrListParu.trEltList[iGeo].iRgLigne = iIndice;\n" \
22505  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
22506  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
22507  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
22508  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
22509  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
22510  " givrListParu.trEltList[iGeo].iLF = (int4)GIV::GIXCodeKO;\n" \
22511  " givrListParu.trEltList[iGeo].iZU = (int4)GIV::GIXCodeOK;\n" \
22512  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
22513  " givrListParu.iNbr++;\n" \
22514  "\n" \
22515  " if ((0 != strcmp(GIVvRegion.acAncReg, GIVvRegion.acRegion)) && (GIV::GIXCodeOK == iIntRet) && (MAX_LIST != givrListParu.iNbr))\n" \
22516  " {\n" \
22517  " /* ancienne région */\n" \
22518  " memcpy(&givrListParu.trEltList[iGeo + 1], &givrListParu.trEltList[iGeo], sizeof(GivrEltListTEpj));\n" \
22519  " strcpy(givrListParu.trEltList[iGeo + 1].reg, GIVvRegion.acAncReg);\n" \
22520  " (void)strcpy(givrListParu.trEltList[iGeo + 1].dep, \"999\");\n" \
22521  " (void)strcpy(givrListParu.trEltList[iGeo + 1].loc, \"99999\");\n" \
22522  " (void)strcpy(givrListParu.trEltList[iGeo + 1].arr, \"99\");\n" \
22523  " givrListParu.trEltRangList[iGeo + 1] = iGeo + 1;\n" \
22524  " givrListParu.iNbr++;\n" \
22525  " }\n" \
22526  " }\n" \
22527  " }\n" \
22528  " }\n" \
22529  " }\n" \
22530  "\n" \
22531  " GWTTrace(GWT_NIV_FONCT, (\"GeoLocParu : %d\\n\", doc->iGeoLoc));\n" \
22532  " GWTTrace(GWT_NIV_FONCT, (\"Nb Parutions %d,%d\\n\", givrListInst.iNbr, givrListParu.iNbr));\n" \
22533  " /* Sortie de la fonction */\n" \
22534  " return (iCodRet);\n" \
22535  "}\n" \
22536  "\n" \
22537  "static int4 givMefMultProfParu(GYBrDOCUMENTEpj* doc, int4 aiParuMax)\n" \
22538  "{\n" \
22539  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
22540  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
22541  " int4 k, l = 0; /* Index de boucle */\n" \
22542  " int4 iGeo;\n" \
22543  " int4 iNbrParu, iNbrParuMax;\n" \
22544  " /* géographie sur rubriques suivantes */\n" \
22545  " iNbrParu = givrListParu.iNbr - aiParuMax;\n" \
22546  " iNbrParuMax = aiParuMax;\n" \
22547  "\n" \
22548  " for (k = 1; k < doc->value.rubriques.iNban9; k++)\n" \
22549  " {\n" \
22550  " for (l = 0; l < iNbrParuMax; l++)\n" \
22551  " {\n" \
22552  " iGeo = givrListParu.iNbr;\n" \
22553  " (void)strcpy(givrListParu.trEltList[iGeo].rub, doc->value.rubriques.Tan9[k].val_codan9);\n" \
22554  " (void)strcpy(givrListParu.trEltList[iGeo].rubinit, doc->value.rubriques.Tan9[k].val_codan8);\n" \
22555  " (void)strcpy(givrListParu.trEltList[iGeo].nature, doc->value.rubriques.Tan9[k].nature);\n" \
22556  " givrListParu.trEltList[iGeo].orig = doc->value.rubriques.Tan9[k].orig;\n" \
22557  " givrListParu.trEltList[iGeo].cParuloc = doc->value.rubriques.Tan9[k].paru;\n" \
22558  " (void)strcpy(givrListParu.trEltList[iGeo].dep, givrListParu.trEltList[iNbrParu + l].dep);\n" \
22559  " (void)strcpy(givrListParu.trEltList[iGeo].loc, givrListParu.trEltList[iNbrParu + l].loc);\n" \
22560  " (void)strcpy(givrListParu.trEltList[iGeo].arr, givrListParu.trEltList[iNbrParu + l].arr);\n" \
22561  " (void)strcpy(givrListParu.trEltList[iGeo].reg, givrListParu.trEltList[iNbrParu + l].reg);\n" \
22562  " givrListParu.trEltList[iGeo].iDbl = givrListParu.trEltList[iNbrParu + l].iDbl;\n" \
22563  " givrListParu.trEltList[iGeo].iRgLigne = givrListParu.trEltList[iNbrParu + l].iRgLigne;\n" \
22564  " givrListParu.trEltList[iGeo].iGeo = 99;\n" \
22565  " givrListParu.trEltList[iGeo].iGeoReg = 99;\n" \
22566  " givrListParu.trEltList[iGeo].iGeoDept = 99;\n" \
22567  " givrListParu.trEltList[iGeo].iGeoLoc = 99;\n" \
22568  " givrListParu.trEltList[iGeo].iGeoArr = 99;\n" \
22569  " givrListParu.trEltList[iGeo].iZU = givrListParu.trEltList[iNbrParu + l].iZU;\n" \
22570  " givrListParu.trEltList[iGeo].iLF = givrListParu.trEltList[iNbrParu + l].iLF;\n" \
22571  " givrListParu.trEltRangList[iGeo] = iGeo;\n" \
22572  " givrListParu.iNbr++;\n" \
22573  " }\n" \
22574  " }\n" \
22575  "\n" \
22576  " GWTTrace(GWT_NIV_FONCT, (\"GeoLocParu : %d\\n\", doc->iGeoLoc));\n" \
22577  " GWTTrace(GWT_NIV_FONCT, (\"Nb Parutions %d,%d\\n\", givrListInst.iNbr, givrListParu.iNbr));\n" \
22578  " /* Sortie de la fonction */\n" \
22579  " return (iCodRet);\n" \
22580  "}\n" \
22581  "\n" \
22582  "/*----Fonction----------------------------------------------------------------*/\n" \
22583  "/* */\n" \
22584  "/* Fonction : givBlocs () */\n" \
22585  "/* */\n" \
22586  "/* But : Ecriture des blocs */\n" \
22587  "/* */\n" \
22588  "/* */\n" \
22589  "/* */\n" \
22590  "/* Entree(s) : */\n" \
22591  "/* */\n" \
22592  "/* Sortie(s) : OK ou KO */\n" \
22593  "/* */\n" \
22594  "/* Portable : Transparent */\n" \
22595  "/* */\n" \
22596  "/*----------------------------------------------------------------------------*/\n" \
22597  "/* */\n" \
22598  "/* Modification (Nov/14/1997 lgu) : V2 ajout objet 11 micro */\n" \
22599  "/* */\n" \
22600  "/*----------------------------------------------------------------------------*/\n" \
22601  "\n" \
22602  "static int4 givBlocs(char** buf_pos_in, GYBrDOCUMENTEpj* docEPJ, GYBrDOCUMENTEpj* docIG, int4 indice)\n" \
22603  "{\n" \
22604  " char* buf_pos;\n" \
22605  " char* buf_pos_ref;\n" \
22606  " char* pcVersion = NULL;\n" \
22607  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
22608  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
22609  " int4 i, j, k, l; /* indices de boucle */\n" \
22610  " int4 lg_write;\n" \
22611  " int4 iNbrInstMax, iNbrParuMax;\n" \
22612  " int4 iNbMicro;\n" \
22613  " GYBrIaparuT rIaparu; /* accès GYTtabIaParu */\n" \
22614  " buf_pos = *buf_pos_in;\n" \
22615  " /* Pointeur sur debut du bloc */\n" \
22616  " buf_pos_ref = buf_pos;\n" \
22617  " iCodRet = giv_ecrit_partie_1(&buf_pos, docIG, indice);\n" \
22618  "\n" \
22619  " if ((int4)GIV::GWCCodeOK == iCodRet)\n" \
22620  " GWTTrace(GWT_NIV_FONCT, (\"ECRITURE PARTIE_1 ...\\n\"));\n" \
22621  "\n" \
22622  " /* écriture de bloc */\n" \
22623  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
22624  " {\n" \
22625  " i = givrListParu.trEltRangList[j];\n" \
22626  " GWTTrace(GWT_NIV_FONCT, (\"Parution [%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d],[%d],[%d\\n\", givrListParu.trEltList[i].iRangTri, givrListParu.trEltList[i].rub, givrListParu.trEltList[i].dep,\n" \
22627  " givrListParu.trEltList[i].loc, givrListParu.trEltList[i].arr, givrListParu.trEltList[i].reg, givrListParu.trEltList[i].iGeoReg, givrListParu.trEltList[i].iGeoDept, givrListParu.trEltList[i].iGeoLoc,\n" \
22628  " givrListParu.trEltList[i].iGeoArr, givrListParu.trEltList[i].iZU, givrListParu.trEltList[i].iRgLigne));\n" \
22629  " }\n" \
22630  "\n" \
22631  " for (j = 0; j < (givrListInst.iNbr); j++)\n" \
22632  " {\n" \
22633  " i = givrListInst.trEltRangList[j];\n" \
22634  " GWTTrace(GWT_NIV_FONCT, (\"Installation [%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d]\\n\", givrListInst.trEltList[i].iRangTri, givrListInst.trEltList[i].rub, givrListInst.trEltList[i].dep,\n" \
22635  " givrListInst.trEltList[i].loc, givrListInst.trEltList[i].arr, givrListInst.trEltList[i].reg, givrListInst.trEltList[i].iGeoReg, givrListInst.trEltList[i].iGeoDept, givrListInst.trEltList[i].iGeoLoc,\n" \
22636  " givrListInst.trEltList[i].iGeoArr));\n" \
22637  " }\n" \
22638  "\n" \
22639  " for (i = 0; i < (indice); i++)\n" \
22640  " {\n" \
22641  " iCodRet = givMefProfInstal((docIG + i), i);\n" \
22642  " (docIG + i)->iSource = 1;\n" \
22643  " }\n" \
22644  "\n" \
22645  " /* Ajout des parutions multiples */\n" \
22646  " for (i = 0; i < (indice); i++)\n" \
22647  " {\n" \
22648  " if (giv_cCHRO == (docIG + i)->value.inscription[0].val_num[0])\n" \
22649  " {\n" \
22650  " j = givrListParu.iNbr;\n" \
22651  " (void)strcpy(rIaparu.acNumnat, (docIG + i)->value.inscription[0].val_num);\n" \
22652  " (void)strcpy(rIaparu.acNumlo, (docIG + i)->value.inscription[0].val_lo);\n" \
22653  " (void)strcpy(rIaparu.acNumls, (docIG + i)->value.inscription[0].val_ls);\n" \
22654  " iCodRet = GIVLectureIAPARU(&rIaparu, 0);\n" \
22655  "\n" \
22656  " if (0 != (docIG + i)->value.rubriques.iNban9 && 1 != (docIG + i)->value.rubriques.iNban9)\n" \
22657  " iCodRet = givMefMultProfParu((docIG + i), (givrListParu.iNbr - j));\n" \
22658  " }\n" \
22659  " }\n" \
22660  "\n" \
22661  " /* Analyse ZU selon LF */\n" \
22662  " iCodRet = givTriZU();\n" \
22663  "\n" \
22664  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
22665  " {\n" \
22666  " i = givrListParu.trEltRangList[j];\n" \
22667  " GWTTrace(GWT_NIV_FONCT, (\"Parution [%d],[%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d],[%d],[%d]\\n\", givrListParu.trEltList[i].iRangTri, givrListParu.trEltList[i].iRgLigne,\n" \
22668  " givrListParu.trEltList[i].rub, givrListParu.trEltList[i].dep, givrListParu.trEltList[i].loc, givrListParu.trEltList[i].arr, givrListParu.trEltList[i].reg, givrListParu.trEltList[i].iGeoReg,\n" \
22669  " givrListParu.trEltList[i].iGeoDept, givrListParu.trEltList[i].iGeoLoc, givrListParu.trEltList[i].iGeoArr, givrListParu.trEltList[i].iZU, givrListParu.trEltList[i].iRgLigne));\n" \
22670  " }\n" \
22671  "\n" \
22672  " for (j = 0; j < (givrListInst.iNbr); j++)\n" \
22673  " {\n" \
22674  " i = givrListInst.trEltRangList[j];\n" \
22675  " GWTTrace(GWT_NIV_FONCT, (\"Installation [%d],[%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d]\\n\", givrListInst.trEltList[i].iRangTri, givrListInst.trEltList[i].iRgLigne, givrListInst.trEltList[i].rub,\n" \
22676  " givrListInst.trEltList[i].dep, givrListInst.trEltList[i].loc, givrListInst.trEltList[i].arr, givrListInst.trEltList[i].reg, givrListInst.trEltList[i].iGeoReg, givrListInst.trEltList[i].iGeoDept,\n" \
22677  " givrListInst.trEltList[i].iGeoLoc, givrListInst.trEltList[i].iGeoArr));\n" \
22678  " }\n" \
22679  "\n" \
22680  " /* nombre de CRC (balise <normale>) */\n" \
22681  " giviNbCRC = 0;\n" \
22682  " givrListCRC.iNbr = 0;\n" \
22683  " /* objets par établissement */\n" \
22684  " iNbMicro = docIG->value.objets_pub.nb_micro;\n" \
22685  " /* lecture des objets de l'etablissement */\n" \
22686  " iCodRet = givLectureObjetsEtab(docIG->value.a_classer.etab, docIG, indice);\n" \
22687  " /* objets par établissement de type Grand Compte */\n" \
22688  " strcpy(docIG->value.objets_pub.libUrlGCpt, \"\");\n" \
22689  " /* lecture des objets de l'etablissement */\n" \
22690  " iCodRet = givLectureObjetsGCpt(docIG->value.a_classer.etab, docIG, indice);\n" \
22691  " iNbMicro = docIG->value.objets_pub.nb_micro - iNbMicro;\n" \
22692  "\n" \
22693  " /* ajout des objets de l'etablissement à chaque MC */\n" \
22694  " for (i = 1; i < indice; i++)\n" \
22695  " {\n" \
22696  " k = docIG->value.objets_pub.nb_micro - iNbMicro;\n" \
22697  " l = (docIG + i)->value.objets_pub.nb_micro;\n" \
22698  "\n" \
22699  " for (j = 0; j < iNbMicro; j++)\n" \
22700  " {\n" \
22701  " strcpy((docIG + i)->value.objets_pub.micro[l + j].type, \"X\");\n" \
22702  " strcpy((docIG + i)->value.objets_pub.micro[l + j].stype, docIG->value.objets_pub.micro[k + j].stype);\n" \
22703  " strcpy((docIG + i)->value.objets_pub.micro[l + j].sstype, docIG->value.objets_pub.micro[k + j].sstype);\n" \
22704  " strcpy((docIG + i)->value.objets_pub.micro[l + j].id, docIG->value.objets_pub.micro[k + j].id);\n" \
22705  " strcpy((docIG + i)->value.objets_pub.libUrlGCpt, docIG->value.objets_pub.libUrlGCpt);\n" \
22706  " }\n" \
22707  "\n" \
22708  " (docIG + i)->value.objets_pub.nb_micro = l + iNbMicro;\n" \
22709  " }\n" \
22710  "\n" \
22711  " /* description des objets au niveau global du bloc epj */\n" \
22712  " iIntRet = givInitTriObj(docIG, indice, GIV::giv_RUB);\n" \
22713  " iCodRet = giv_ecrit_partie_2_1(&buf_pos, docEPJ, docIG, indice);\n" \
22714  "\n" \
22715  " if ((int4)GIV::GWCCodeOK == iCodRet)\n" \
22716  " GWTTrace(GWT_NIV_FONCT, (\"ECRITURE PARTIE_2_1 ...\\n\"));\n" \
22717  "\n" \
22718  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
22719  " {\n" \
22720  " i = givrListParu.trEltRangList[j];\n" \
22721  " GWTTrace(GWT_NIV_FONCT, (\"Parution [%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d],[%d],[%d],[%d]\\n\", givrListParu.trEltList[i].iRangTri, givrListParu.trEltList[i].rub,\n" \
22722  " givrListParu.trEltList[i].dep, givrListParu.trEltList[i].loc, givrListParu.trEltList[i].arr, givrListParu.trEltList[i].reg, givrListParu.trEltList[i].iGeoReg, givrListParu.trEltList[i].iGeoDept,\n" \
22723  " givrListParu.trEltList[i].iGeoLoc, givrListParu.trEltList[i].iGeoArr, givrListParu.trEltList[i].iZU, givrListParu.trEltList[i].iDbl, givrListParu.trEltList[i].iRgLigne));\n" \
22724  " }\n" \
22725  "\n" \
22726  " for (j = 0; j < (givrListInst.iNbr); j++)\n" \
22727  " {\n" \
22728  " i = givrListInst.trEltRangList[j];\n" \
22729  " GWTTrace(GWT_NIV_FONCT, (\"Installation [%d],[%s],[%s],[%s],[%s],[%s],[%d],[%d],[%d],[%d]\\n\", givrListInst.trEltList[i].iRangTri, givrListInst.trEltList[i].rub, givrListInst.trEltList[i].dep,\n" \
22730  " givrListInst.trEltList[i].loc, givrListInst.trEltList[i].arr, givrListInst.trEltList[i].reg, givrListInst.trEltList[i].iGeoReg, givrListInst.trEltList[i].iGeoDept, givrListInst.trEltList[i].iGeoLoc,\n" \
22731  " givrListInst.trEltList[i].iGeoArr));\n" \
22732  " }\n" \
22733  "\n" \
22734  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"parutions\");\n" \
22735  " buf_pos = buf_pos + lg_write;\n" \
22736  " /* tri d'init des rangs d'objet */\n" \
22737  " givrListParu.iNbrTot = givrListParu.iNbr;\n" \
22738  " givrListInst.iNbrTot = givrListInst.iNbr;\n" \
22739  " iIntRet = givInitTriObjGeo(docIG, indice, GIV::giv_RUB);\n" \
22740  " iIntRet = givInitTriAn9Geo();\n" \
22741  " iIntRet = givInitTriDenomGeo(GIV::giv_RUB);\n" \
22742  " /* Tri global sur An9 */\n" \
22743  " iIntRet = givTriGeo(docIG, indice, GIV::giv_RUB);\n" \
22744  " /* Ecriture dans le fichier de sortie en UTF8 */\n" \
22745  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
22746  " iCodRet = giv_ecrit_partie_3(&buf_pos, docIG, indice, GIV::giv_RUB);\n" \
22747  "\n" \
22748  " if ('\\0' != GIVBuffXML[0])\n" \
22749  " {\n" \
22750  " /* Ecriture dans le fichier de sortie */\n" \
22751  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
22752  " }\n" \
22753  "\n" \
22754  " if ((int4)GIV::GWCCodeOK == iCodRet)\n" \
22755  " GWTTrace(GWT_NIV_FONCT, (\"ECRITURE PARTIE_3 An9 ...\\n\"));\n" \
22756  "\n" \
22757  " for (j = 0; j < (givrListParu.iNbrTot); j++)\n" \
22758  " {\n" \
22759  " i = givrListParu.trEltRangList[j];\n" \
22760  "\n" \
22761  " if ((j < givrListParu.iNbr) && ((int4)GIV::GIXCodeOK == givrListParu.trEltList[i].iZU))\n" \
22762  " {\n" \
22763  " /* restauration parution ZU Pôle */\n" \
22764  " givrListParu.trEltList[i].iZU = (int4)GIV::GIXCodeKO;\n" \
22765  " }\n" \
22766  "\n" \
22767  " givrListParu.trEltList[i].iGeo = 99;\n" \
22768  " givrListParu.trEltList[i].iGeoReg = 99;\n" \
22769  " givrListParu.trEltList[i].iGeoDept = 99;\n" \
22770  " givrListParu.trEltList[i].iGeoLoc = 99;\n" \
22771  " givrListParu.trEltList[i].iGeoArr = 99;\n" \
22772  " }\n" \
22773  "\n" \
22774  " for (i = 0; i < (givrListInst.iNbrTot); i++)\n" \
22775  " {\n" \
22776  " givrListInst.trEltList[i].iGeo = 99;\n" \
22777  " givrListInst.trEltList[i].iGeoReg = 99;\n" \
22778  " givrListInst.trEltList[i].iGeoDept = 99;\n" \
22779  " givrListInst.trEltList[i].iGeoLoc = 99;\n" \
22780  " givrListInst.trEltList[i].iGeoArr = 99;\n" \
22781  " }\n" \
22782  "\n" \
22783  " givrListParu.iNbr = givrListParu.iNbrTot;\n" \
22784  " givrListInst.iNbr = givrListInst.iNbrTot;\n" \
22785  " /* tri d'init des rangs de dénomination */\n" \
22786  " iIntRet = givInitTriDenomGeo(GIV::giv_DNOM);\n" \
22787  " /* Tri global sur Denom */\n" \
22788  " iIntRet = givTriGeo(docIG, indice, GIV::giv_DNOM);\n" \
22789  " /* Ecriture dans le fichier de sortie en UTF8 */\n" \
22790  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
22791  " iCodRet = giv_ecrit_partie_3(&buf_pos, docIG, indice, GIV::giv_DNOM);\n" \
22792  "\n" \
22793  " if ('\\0' != GIVBuffXML[0])\n" \
22794  " {\n" \
22795  " /* Ecriture dans le fichier de sortie */\n" \
22796  " iCodRet = giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
22797  " }\n" \
22798  "\n" \
22799  " if ((int4)GIV::GWCCodeOK == iCodRet)\n" \
22800  " GWTTrace(GWT_NIV_FONCT, (\"ECRITURE PARTIE_3 Denom...\\n\"));\n" \
22801  "\n" \
22802  " for (j = 0; j < (givrListParu.iNbrTot); j++)\n" \
22803  " {\n" \
22804  " i = givrListParu.trEltRangList[j];\n" \
22805  "\n" \
22806  " if ((j < givrListParu.iNbr) && ((int4)GIV::GIXCodeOK == givrListParu.trEltList[i].iZU))\n" \
22807  " {\n" \
22808  " /* restauration parution ZU Pôle */\n" \
22809  " givrListParu.trEltList[i].iZU = (int4)GIV::GIXCodeKO;\n" \
22810  " givrListParu.trEltList[i].iRgDnom = -1;\n" \
22811  " }\n" \
22812  "\n" \
22813  " if (-1 == givrListParu.trEltList[i].iRgGeoTri)\n" \
22814  " givrListParu.trEltList[i].iRgDnom = -1;\n" \
22815  "\n" \
22816  " givrListParu.trEltList[i].iGeo = 99;\n" \
22817  " givrListParu.trEltList[i].iGeoReg = 99;\n" \
22818  " givrListParu.trEltList[i].iGeoDept = 99;\n" \
22819  " givrListParu.trEltList[i].iGeoLoc = 99;\n" \
22820  " givrListParu.trEltList[i].iGeoArr = 99;\n" \
22821  " }\n" \
22822  "\n" \
22823  " for (i = 0; i < (givrListInst.iNbrTot); i++)\n" \
22824  " {\n" \
22825  " givrListInst.trEltList[i].iGeo = 99;\n" \
22826  " givrListInst.trEltList[i].iGeoReg = 99;\n" \
22827  " givrListInst.trEltList[i].iGeoDept = 99;\n" \
22828  " givrListInst.trEltList[i].iGeoLoc = 99;\n" \
22829  " givrListInst.trEltList[i].iGeoArr = 99;\n" \
22830  " }\n" \
22831  "\n" \
22832  " givrListParu.iNbr = givrListParu.iNbrTot;\n" \
22833  " givrListInst.iNbr = givrListInst.iNbrTot;\n" \
22834  "\n" \
22835  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
22836  " {\n" \
22837  " i = givrListParu.trEltRangList[j];\n" \
22838  " GWTTrace(GWT_NIV_FONCT, (\"Pôle ZU Dnom [%d],[%d],[%d],[%s],[%s]\\n\", givrListParu.trEltList[i].iRangTri, givrListParu.trEltList[i].iRgDnom, givrListParu.trEltList[i].iZU,\n" \
22839  " givrListParu.trEltList[i].dep, givrListParu.trEltList[i].loc));\n" \
22840  " }\n" \
22841  "\n" \
22842  " /* init type des contenus de l'établissement */\n" \
22843  " giviNbContEtab = 0;\n" \
22844  " iIntRet = givLectureTypeContEtab((docIG)->value.a_classer.etab);\n" \
22845  "\n" \
22846  " for (i = 0; i < giviNbContEtab; i++)\n" \
22847  " GWTTrace(GWT_NIV_FONCT, (\"Type contenu EPJ [%s],[%s],[%s]\\n\", givrListContEtab[i].tcEtab, givrListContEtab[i].tcType, givrListContEtab[i].tcThm));\n" \
22848  "\n" \
22849  " /* init des contenus prof de l'établissement */\n" \
22850  " giviNbProfEtab = 0;\n" \
22851  " iIntRet = givLectureContProfEtab((docIG)->value.a_classer.etab);\n" \
22852  "\n" \
22853  " for (i = 0; i < giviNbProfEtab; i++)\n" \
22854  " GWTTrace(GWT_NIV_FONCT, (\"contenu Prof EPJ [%s],[%s],[%s],[%c]\\n\", givrListProfEtab[i].tcType, givrListProfEtab[i].tcEtab, givrListProfEtab[i].tcAn8, givrListProfEtab[i].cIndic));\n" \
22855  "\n" \
22856  " /* tri d'init des rangs d'objet */\n" \
22857  " iIntRet = givInitTriObjGeo(docIG, indice, GIV::giv_OBJ);\n" \
22858  "\n" \
22859  " /* Tri global sur objet */\n" \
22860  " if (0 != givrListParu.iNbrTri)\n" \
22861  " {\n" \
22862  " /* présence d'objet */\n" \
22863  " iIntRet = givTriGeo(docIG, indice, GIV::giv_OBJ);\n" \
22864  " iCodRet = giv_ecrit_partie_3(&buf_pos, docIG, indice, GIV::giv_OBJ);\n" \
22865  "\n" \
22866  " if ('\\0' != GIVBuffXML[0])\n" \
22867  " {\n" \
22868  " /* Ecriture dans le fichier de sortie */\n" \
22869  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
22870  " }\n" \
22871  " }\n" \
22872  "\n" \
22873  " {\n" \
22874  " GWTTrace(GWT_NIV_FONCT, (\"ECRITURE PARTIE_3 Objet...\\n\"));\n" \
22875  " }\n" \
22876  "\n" \
22877  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"parutions\");\n" \
22878  " buf_pos = buf_pos + lg_write;\n" \
22879  "\n" \
22880  " if (0 != givrListObj.iNbrTri)\n" \
22881  " {\n" \
22882  " /* liens objets-rubriques */\n" \
22883  " iCodRet = giv_ecrit_partie_3_obj(&buf_pos, docIG);\n" \
22884  " }\n" \
22885  "\n" \
22886  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"inscriptions\");\n" \
22887  " buf_pos = buf_pos + lg_write;\n" \
22888  "\n" \
22889  " for (j = 0; j < (givrListParu.iNbrTot); j++)\n" \
22890  " {\n" \
22891  " i = givrListParu.trEltRangList[j];\n" \
22892  "\n" \
22893  " if ((j < givrListParu.iNbr) && ((int4)GIV::GIXCodeOK == givrListParu.trEltList[i].iZU) && (0 != givrListParu.iNbrTri))\n" \
22894  " {\n" \
22895  " /* restauration parution ZU Pôle */\n" \
22896  " givrListParu.trEltList[i].iZU = (int4)GIV::GIXCodeKO;\n" \
22897  " }\n" \
22898  "\n" \
22899  " givrListParu.trEltList[i].iGeo = 99;\n" \
22900  " givrListParu.trEltList[i].iGeoReg = 99;\n" \
22901  " givrListParu.trEltList[i].iGeoDept = 99;\n" \
22902  " givrListParu.trEltList[i].iGeoLoc = 99;\n" \
22903  " givrListParu.trEltList[i].iGeoArr = 99;\n" \
22904  " }\n" \
22905  "\n" \
22906  " for (i = 0; i < (givrListInst.iNbrTot); i++)\n" \
22907  " {\n" \
22908  " givrListInst.trEltList[i].iGeo = 99;\n" \
22909  " givrListInst.trEltList[i].iGeoReg = 99;\n" \
22910  " givrListInst.trEltList[i].iGeoDept = 99;\n" \
22911  " givrListInst.trEltList[i].iGeoLoc = 99;\n" \
22912  " givrListInst.trEltList[i].iGeoArr = 99;\n" \
22913  " }\n" \
22914  "\n" \
22915  " givrListParu.iNbr = givrListParu.iNbrTot;\n" \
22916  " givrListInst.iNbr = givrListInst.iNbrTot;\n" \
22917  "\n" \
22918  " /* analyse Pôle de ZU */\n" \
22919  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
22920  " {\n" \
22921  " i = givrListParu.trEltRangList[j];\n" \
22922  " GWTTrace(GWT_NIV_FONCT, (\"Pôle ZU [%d],[%d],[%d],[%s],[%s]\\n\", givrListParu.trEltList[i].iRangTri, givrListParu.trEltList[i].iRgDnom, givrListParu.trEltList[i].iZU, givrListParu.trEltList[i].dep,\n" \
22923  " givrListParu.trEltList[i].loc));\n" \
22924  " }\n" \
22925  "\n" \
22926  " for (j = 0; j < givrListParu.iNbr; j++)\n" \
22927  " {\n" \
22928  " i = givrListParu.trEltRangList[j];\n" \
22929  " givrListParu.trEltList[i].iRangTri = (int4)0;\n" \
22930  "\n" \
22931  " if ((int4)GIV::GIXCodeOK != givrListParu.trEltList[i].iZU)\n" \
22932  " continue;\n" \
22933  "\n" \
22934  " /* validation d'un pôle de ZU */\n" \
22935  " for (l = 0; l < givrListParu.iNbr; l++)\n" \
22936  " {\n" \
22937  " if (l == j)\n" \
22938  " continue;\n" \
22939  "\n" \
22940  " k = givrListParu.trEltRangList[l];\n" \
22941  "\n" \
22942  " if ((0 == strcmp(givrListParu.trEltList[i].dep, givrListParu.trEltList[k].dep)) && (0 == strcmp(givrListParu.trEltList[i].loc, givrListParu.trEltList[k].loc))\n" \
22943  " && ((int4)GIV::GIXCodeOK != givrListParu.trEltList[k].iZU))\n" \
22944  " {\n" \
22945  " /* validation */\n" \
22946  " givrListParu.trEltList[k].iRangTri = (int4) - 1;\n" \
22947  " break;\n" \
22948  " }\n" \
22949  " }\n" \
22950  "\n" \
22951  " if (givrListParu.iNbr == l)\n" \
22952  " {\n" \
22953  " /* pas de validation */\n" \
22954  " givrListParu.trEltList[i].iRangTri = (int4) - 1;\n" \
22955  " }\n" \
22956  " }\n" \
22957  "\n" \
22958  " for (j = 0; j < givrListParu.iNbr; j++)\n" \
22959  " {\n" \
22960  " i = givrListParu.trEltRangList[j];\n" \
22961  "\n" \
22962  " if ((-1 == givrListParu.trEltList[i].iRgDnom) && (0 == givrListParu.trEltList[i].iRangTri) && ((int4)GIV::GIXCodeOK != givrListParu.trEltList[i].iZU))\n" \
22963  " givrListParu.trEltList[i].iRangTri = -1;\n" \
22964  " }\n" \
22965  "\n" \
22966  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
22967  " {\n" \
22968  " i = givrListParu.trEltRangList[j];\n" \
22969  " GWTTrace(GWT_NIV_FONCT, (\"Pôle ZU Ins [%d],[%d],[%d],[%s],[%s]\\n\", givrListParu.trEltList[i].iRangTri, givrListParu.trEltList[i].iRgDnom, givrListParu.trEltList[i].iZU, givrListParu.trEltList[i].dep,\n" \
22970  " givrListParu.trEltList[i].loc));\n" \
22971  " }\n" \
22972  "\n" \
22973  " for (i = 0; i < indice; i++)\n" \
22974  " {\n" \
22975  " /* Tri par ligne */\n" \
22976  " iIntRet = givTriGeoIns(docIG + i, i);\n" \
22977  " iCodRet = giv_ecrit_partie_2_2(&buf_pos, docIG + i, i, docIG, indice);\n" \
22978  "\n" \
22979  " if ((int4)GIV::GWCCodeOK == iCodRet)\n" \
22980  " GWTTrace(GWT_NIV_FONCT, (\"ECRITURE PARTIE_2_2 ...\\n\"));\n" \
22981  "\n" \
22982  " iCodRet = giv_ecrit_partie_3_ins(&buf_pos, docIG + i, indice);\n" \
22983  "\n" \
22984  " if ('\\0' != GIVBuffXML[0])\n" \
22985  " {\n" \
22986  " /* Ecriture dans le fichier de sortie */\n" \
22987  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
22988  " }\n" \
22989  "\n" \
22990  " if ((int4)GIV::GWCCodeOK == iCodRet)\n" \
22991  " GWTTrace(GWT_NIV_FONCT, (\"ECRITURE PARTIE_3_INS ...\\n\"));\n" \
22992  " }\n" \
22993  "\n" \
22994  " iCodRet = giv_ecrit_partie_2_3(&buf_pos, docIG, indice);\n" \
22995  "\n" \
22996  " if ((int4)GIV::GWCCodeOK == iCodRet)\n" \
22997  " GWTTrace(GWT_NIV_FONCT, (\"ECRITURE PARTIE_2_3 ...\\n\"));\n" \
22998  "\n" \
22999  " /* Fin document */\n" \
23000  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"document\");\n" \
23001  " buf_pos = buf_pos + lg_write;\n" \
23002  "\n" \
23003  " if ('\\0' != GIVBuffXML[0])\n" \
23004  " {\n" \
23005  " /* Ecriture dans le fichier de sortie */\n" \
23006  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
23007  " }\n" \
23008  "\n" \
23009  " /* enrichissement du bloc */\n" \
23010  " if ((int4)GIV::GIXCodeOK == giviEnrich)\n" \
23011  " {\n" \
23012  " GIVAnnulerBlocCGenTest = 0;\n" \
23013  " iIntRet = GIVEnrichirTest(docIG->value.a_classer.etab, GIVBuffTest, givtcMoteur);\n" \
23014  "\n" \
23015  " if (iIntRet != GIV::GWZOk)\n" \
23016  " {\n" \
23017  " sprintf(GIVBuffTest, \"<!-- Non-generation du bloc EPJ pour l'etab %s pour cause d'echec CGenTest -->\\n\", docIG->value.a_classer.etab);\n" \
23018  " GWTTrace(GWT_NIV_GRAVE, (\"Non-generation du bloc EPJ pour l'etab %s pour cause d'echec CGenTest\\n\", docIG->value.a_classer.etab));\n" \
23019  " GIVAnnulerBlocCGenTest = 1;\n" \
23020  " }\n" \
23021  " }\n" \
23022  "\n" \
23023  " pcVersion = strchr(pcVersionInsFour[0], (char)'.');\n" \
23024  " pcVersion++;\n" \
23025  " iIntRet = givFin(&buf_pos, docIG->parution_id);\n" \
23026  "\n" \
23027  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
23028  " {\n" \
23029  " /* Erreur sur ecriture fin document */\n" \
23030  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur sur ecriture fin document dans partie_3 ...\\n\"));\n" \
23031  " iCodRet = (int4)GIV::GWCCodeKO;\n" \
23032  " }\n" \
23033  "\n" \
23034  " /* Pointeur sur debut du buffer */\n" \
23035  " buf_pos = GIVBuffXML;\n" \
23036  " /* Effacement du buffer */\n" \
23037  " GIVBuffXML[0] = '\\0';\n" \
23038  " *buf_pos_in = buf_pos;\n" \
23039  " /* Sortie de la fonction */\n" \
23040  " return (iCodRet);\n" \
23041  "}\n" \
23042  "\n" \
23043  "/*----Fonction----------------------------------------------------------------*/\n" \
23044  "/* */\n" \
23045  "/* Fonction : givDelIeBlocCRC */\n" \
23046  "/* */\n" \
23047  "/* But : suppression des CRC du bloc dans GYTtabIeBlocCRC */\n" \
23048  "/* de l'ensemble du bloc */\n" \
23049  "/* */\n" \
23050  "/* Entree(s) : un buffer, documents */\n" \
23051  "/* */\n" \
23052  "/* Sortie(s) : OK ou KO */\n" \
23053  "/* */\n" \
23054  "/* Portable : Transparent */\n" \
23055  "/* */\n" \
23056  "/* Création (Oct/04/2012 - mb) */\n" \
23057  "/*----------------------------------------------------------------------------*/\n" \
23058  "\n" \
23059  "static int4 givDelIeBlocCRC(char* acBlocid)\n" \
23060  "\n" \
23061  "{\n" \
23062  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
23063  " EXEC SQL\n" \
23064  " begin declare\n" \
23065  " section;\n" \
23066  " char cBlocid[26 + 1];\n" \
23067  " char tcRequete[1024];\n" \
23068  " EXEC SQL\n" \
23069  " end declare\n" \
23070  " section;\n" \
23071  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
23072  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Suppression anciens blocs GYTtabIeBlocCRC\");\n" \
23073  " (void)strcpy(cBlocid, acBlocid);\n" \
23074  " GWTTrace(GWT_NIV_FONCT, (\"blocid : %s\\n\", cBlocid));\n" \
23075  " EXEC SQL\n" \
23076  " execute rqtDelIeBlocCRC\n" \
23077  " using :cBlocid;\n" \
23078  " iCodRet = GIVBlocErreur(&vErreurSQL);\n" \
23079  "\n" \
23080  " /* Analyse du code resultat SQL */\n" \
23081  " if (((int4)GIV::GWCCodeOK != iCodRet) && ((int4)GIV::GYBnodata != iCodRet))\n" \
23082  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur : [COD=%d TXT=%s]\\n\", iCodRet, vErreurSQL.acOrdre_sql));\n" \
23083  "\n" \
23084  " return (iCodRet);\n" \
23085  "}\n" \
23086  "\n" \
23087  "/*----Fonction----------------------------------------------------------------*/\n" \
23088  "/* */\n" \
23089  "/* Fonction : givInsIeBlocCRC */\n" \
23090  "/* */\n" \
23091  "/* But : insertion d'un CRC du bloc dans GYTtabIeBlocCRC */\n" \
23092  "/* */\n" \
23093  "/* Entree(s) : un buffer, documents */\n" \
23094  "/* */\n" \
23095  "/* Sortie(s) : OK ou KO */\n" \
23096  "/* */\n" \
23097  "/* Portable : Transparent */\n" \
23098  "/* */\n" \
23099  "/* Création (Oct/04/2012 - mb) */\n" \
23100  "/*----------------------------------------------------------------------------*/\n" \
23101  "\n" \
23102  "static int4 givInsIeBlocCRC(void)\n" \
23103  "\n" \
23104  "{\n" \
23105  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
23106  " int4 i, p;\n" \
23107  " EXEC SQL\n" \
23108  " begin declare\n" \
23109  " section;\n" \
23110  " GYBrPrioCRCT* prOraPrioCRC;\n" \
23111  " char cBlocid[26 + 1];\n" \
23112  " char tcRequete[1024];\n" \
23113  " char* pcVersion;\n" \
23114  " /* tables pour insertion globale */\n" \
23115  " int4 j;\n" \
23116  " char tcVersion[MAX_LIST_CRC][GXWLgIdDonnees]; /* version du bloc */\n" \
23117  " GYBstrBlocBlocidT trBlocid[MAX_LIST_CRC]; /* numero de bloc */\n" \
23118  " GYBstrPrioTypeT trType[MAX_LIST_CRC]; /* type de crc */\n" \
23119  " char tcCodan8[MAX_LIST_CRC][GYBIaprofLgCodan8 + 1]; /* code AN8 */\n" \
23120  " char tcTpdsob[MAX_LIST_CRC][GYBIamicLgTpdsob + 1]; /* source (type dans l objet) */\n" \
23121  " GYBstrIeinscEtabT trEtab[MAX_LIST_CRC]; /* code etablissement */\n" \
23122  " GYBstrPrioCRCT trCRC[MAX_LIST_CRC]; /* contenu CRC */\n" \
23123  " EXEC SQL\n" \
23124  " end declare\n" \
23125  " section;\n" \
23126  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
23127  " static int4 iDejaPrepare = (int4)GIV::GWCCodeKO;\n" \
23128  " /* version du bloc */\n" \
23129  " pcVersion = strchr(pcVersionInsFour[0], (char)'.');\n" \
23130  " pcVersion++;\n" \
23131  " j = 0;\n" \
23132  "\n" \
23133  " for (i = 0; i < givrListCRC.iNbr; i++)\n" \
23134  " {\n" \
23135  " p = givrListCRC.trEltRangList[i];\n" \
23136  "\n" \
23137  " if ((0 != strlen(givrListCRC.trEltList[p].acEtab)) && (-1 != givrListCRC.trEltList[p].iRgEtab) && (-1 != givrListCRC.trEltList[p].iRgCRC))\n" \
23138  " {\n" \
23139  " /* insetion CRC sur blocid dans GYTtabIeBlocCRC */\n" \
23140  " (void)strcpy(tcVersion[j], pcVersion);\n" \
23141  " (void)strcpy(trBlocid[j], nom_bloc_ref);\n" \
23142  " (void)strcpy(tcCodan8[j], givrListCRC.trEltList[p].acCodan8);\n" \
23143  " (void)strcpy(tcTpdsob[j], givrListCRC.trEltList[p].acTpdsob);\n" \
23144  " (void)strcpy(trType[j], givrListCRC.trEltList[p].acType);\n" \
23145  " (void)strcpy(trEtab[j], givrListCRC.trEltList[p].acEtab);\n" \
23146  " (void)strcpy(trCRC[j], givrListCRC.trEltList[p].acCRC);\n" \
23147  " j++;\n" \
23148  " }\n" \
23149  " }\n" \
23150  "\n" \
23151  " if (0 == j)\n" \
23152  " return (iCodRet);\n" \
23153  "\n" \
23154  " if ((int4)GIV::GWCCodeOK != iDejaPrepare)\n" \
23155  " {\n" \
23156  " (void)sprintf(tcRequete, GIV_INS_IEBLOC_CRC, GIXcNomDest);\n" \
23157  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Insertion bloc GYTtabIeBlocCRC\");\n" \
23158  " EXEC SQL\n" \
23159  " prepare rqtInsIeBlocCRC\n" \
23160  " from: tcRequete;\n" \
23161  " iDejaPrepare = (int4)GIV::GWCCodeOK;\n" \
23162  " }\n" \
23163  "\n" \
23164  " GWTTrace(GWT_NIV_FONCT, (\"blocid : %s\\n\", nom_bloc_ref));\n" \
23165  " EXEC SQL\n" \
23166  " FOR :j execute\n" \
23167  " rqtInsIeBlocCRC\n" \
23168  " using :trBlocid,\n" \
23169  " :trEtab,\n" \
23170  " :trCRC,\n" \
23171  " :trType,\n" \
23172  " :tcCodan8,\n" \
23173  " :tcTpdsob,\n" \
23174  " :tcVersion;\n" \
23175  " iCodRet = GIVBlocErreur(&vErreurSQL);\n" \
23176  "\n" \
23177  " /* Analyse du code resultat SQL */\n" \
23178  " if ((int4)GIV::GWCCodeOK != iCodRet)\n" \
23179  " {\n" \
23180  " GWTTrace(GWT_NIV_BIZAR, (\"echec insert crc : %s,%s\\n\", nom_bloc_ref, pcVersion));\n" \
23181  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur : [COD=%d TXT=%s]\\n\", iCodRet, vErreurSQL.acOrdre_sql));\n" \
23182  " }\n" \
23183  "\n" \
23184  " return (iCodRet);\n" \
23185  "}\n" \
23186  "\n" \
23187  "/*----Fonction----------------------------------------------------------------*/\n" \
23188  "/* */\n" \
23189  "/* Fonction : givGroupement () */\n" \
23190  "/* */\n" \
23191  "/* But : Ecriture des blocs groupement simples et clones */\n" \
23192  "/* */\n" \
23193  "/* */\n" \
23194  "/* */\n" \
23195  "/* Entree(s) : */\n" \
23196  "/* */\n" \
23197  "/* Sortie(s) : OK ou KO */\n" \
23198  "/* */\n" \
23199  "/* Portable : Transparent */\n" \
23200  "/* */\n" \
23201  "/*----------------------------------------------------------------------------*/\n" \
23202  "/* */\n" \
23203  "/* Modification (Nov/14/1997 lgu) : V2 ajout objet 11 micro */\n" \
23204  "/* */\n" \
23205  "/*----------------------------------------------------------------------------*/\n" \
23206  "\n" \
23207  "static int4 givGroupement(char** buf_pos_in, GYBrDOCUMENTEpj* docEPJ, GYBrDOCUMENTEpj* docIG, int4 indice)\n" \
23208  "{\n" \
23209  " char* buf_pos;\n" \
23210  " int4 i, m, n, p;\n" \
23211  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
23212  " EXEC SQL\n" \
23213  " begin declare\n" \
23214  " section;\n" \
23215  " char cBlocid[26 + 1];\n" \
23216  " char tcRequete[1024];\n" \
23217  " char cDepart[GYBIeinscLgDeppar + 1];\n" \
23218  " EXEC SQL\n" \
23219  " end declare\n" \
23220  " section;\n" \
23221  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
23222  " buf_pos = *buf_pos_in;\n" \
23223  " GYBstrIeinscDenomT rDenom;\n" \
23224  " int4 iRang;\n" \
23225  " giviPart = (int4)GIV::GWCCodeOK;\n" \
23226  "\n" \
23227  " for (p = 0; p < indice; p++)\n" \
23228  " {\n" \
23229  " if (('0' <= (docIG + p)->value.inscription[0].val_num[0]) && ('9' >= (docIG + p)->value.inscription[0].val_num[0]))\n" \
23230  " {\n" \
23231  " giviPart = (int4)GIV::GWCCodeKO;\n" \
23232  " break;\n" \
23233  " }\n" \
23234  " }\n" \
23235  "\n" \
23236  " GWTTrace(GWT_NIV_FONCT, (\"part :'%s', '%d'\\n\", docIG->value.inscription[0].val_num, giviPart));\n" \
23237  "\n" \
23238  " for (p = 1; p < indice; p++)\n" \
23239  " {\n" \
23240  " if (docIG->iRang != (docIG + p)->iRang)\n" \
23241  " break;\n" \
23242  " }\n" \
23243  "\n" \
23244  " /* enrichissement du bloc */\n" \
23245  " giviEnrich = (int4)GIV::GIXCodeKO;\n" \
23246  "\n" \
23247  " for (n = 0; n < GIViNbEPJTest; n++)\n" \
23248  " {\n" \
23249  " if (0 == strcmp(docIG->value.a_classer.etab, GIVtrEPJTest[n]))\n" \
23250  " {\n" \
23251  " /* enrichissement configuré */\n" \
23252  " giviEnrich = (int4)GIV::GIXCodeOK;\n" \
23253  " break;\n" \
23254  " }\n" \
23255  " }\n" \
23256  "\n" \
23257  " GWTTrace(GWT_NIV_FONCT, (\"Enrichissement :'%d'\\n\", giviEnrich));\n" \
23258  " /* Rang de tri de dénomination dans document d'une ligne */\n" \
23259  " strcpy(rDenom, \" \");\n" \
23260  " iRang = -1;\n" \
23261  "\n" \
23262  " for (n = 0; n < indice; n++)\n" \
23263  " {\n" \
23264  " if ((0 != strcmp(rDenom, (docIG + n)->value.intitule.denomination)) || (0 == n))\n" \
23265  " {\n" \
23266  " /* rang denom identique au rang de doc */\n" \
23267  " iRang = n;\n" \
23268  " strcpy(rDenom, (docIG + n)->value.intitule.denomination);\n" \
23269  " }\n" \
23270  "\n" \
23271  " (docIG + n)->value.intitule.iRgDnom = iRang;\n" \
23272  " sprintf((docIG + n)->value.intitule.tcRgDnom, \"%04d\", iRang);\n" \
23273  " GWTTrace(GWT_NIV_FONCT, (\"dénom triées :'%d', '%s'\\n\", iRang, (docIG + n)->value.intitule.tcRgDnom));\n" \
23274  " }\n" \
23275  "\n" \
23276  " /* Report du numéro de client sur toutes les lignes */\n" \
23277  " for (n = 0; n < indice; n++)\n" \
23278  " {\n" \
23279  " if (0 != strlen((docIG + n)->value.numero_client))\n" \
23280  " {\n" \
23281  " for (m = 0; m < indice; m++)\n" \
23282  " {\n" \
23283  " if (0 == strlen((docIG + m)->value.numero_client))\n" \
23284  " strcpy((docIG + m)->value.numero_client, (docIG + n)->value.numero_client);\n" \
23285  " }\n" \
23286  "\n" \
23287  " break;\n" \
23288  " }\n" \
23289  " }\n" \
23290  "\n" \
23291  " /* au moins un bloc à écrire */\n" \
23292  " iMaxBlocEcritAvant++;\n" \
23293  " giviCodRetEcr = (int4)GIV::GIXCodeOK;\n" \
23294  " /* Bloc ordonné par rang */\n" \
23295  " iCodRet = givBlocs(&buf_pos, docEPJ, docIG, indice);\n" \
23296  "\n" \
23297  " if ((int4)GIV::GIXCodeOK != giviCodRetEcr)\n" \
23298  " {\n" \
23299  " *buf_pos_in = buf_pos;\n" \
23300  " givrListParu.iNbr = 0;\n" \
23301  " givrListInst.iNbr = 0;\n" \
23302  " }\n" \
23303  "\n" \
23304  " if (!GIVAnnulerBlocCGenTest)\n" \
23305  " {\n" \
23306  " if (0 == strcmp(GIVtcGeneIeBloc, \"OUI\"))\n" \
23307  " {\n" \
23308  " /* suppressions de lignes du blocid */\n" \
23309  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Suppression anciens blocs GYTtabIeBloc\");\n" \
23310  " (void)strcpy((char*)cDepart, (const char*)GIXcDepartement);\n" \
23311  " (void)strcpy(cBlocid, nom_bloc_ref);\n" \
23312  " GWTTrace(GWT_NIV_FONCT, (\"blocid : %s\\n\", cBlocid));\n" \
23313  " EXEC SQL\n" \
23314  " execute rqtDelIeBloc\n" \
23315  " using\n" \
23316  " :cDepart,\n" \
23317  " :cBlocid;\n" \
23318  " iCodRet = GIVBlocErreur(&vErreurSQL);\n" \
23319  "\n" \
23320  " /* Analyse du code resultat SQL */\n" \
23321  " if (((int4)GIV::GWCCodeOK != iCodRet) && ((int4)GIV::GYBnodata != iCodRet))\n" \
23322  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur : [COD=%d TXT=%s]\\n\", iCodRet, vErreurSQL.acOrdre_sql));\n" \
23323  "\n" \
23324  " /* maj table des blocs pour un bloc à la source */\n" \
23325  " for (i = 0; (i < indice); i++)\n" \
23326  " {\n" \
23327  " /* ligne par ligne */\n" \
23328  " iCodRet = giv_ecrit_tabIeBloc(docIG + i);\n" \
23329  " }\n" \
23330  "\n" \
23331  " if ((0 == strcmp(\"OUI\", givtcGeneIeBlocCRC)) && (0 != strcmp(givRecreerCD, GIXcNomFour)))\n" \
23332  " {\n" \
23333  " /* suppression sur blocid dans GYTtabIeBlocCRC */\n" \
23334  " iCodRet = givDelIeBlocCRC(nom_bloc_ref);\n" \
23335  " }\n" \
23336  "\n" \
23337  " /* mise à jour TabIeBlocCRC */\n" \
23338  " if (0 == strcmp(\"OUI\", givtcGeneIeBlocCRC))\n" \
23339  " iCodRet = givInsIeBlocCRC();\n" \
23340  " }\n" \
23341  "\n" \
23342  " if ((int4)GIV::GWCCodeOK == iCodRet)\n" \
23343  " GWTTrace(GWT_NIV_FONCT, (\"ECRITURE TABLE BLOCS DE PARUTIONS ...\\n\"));\n" \
23344  " }\n" \
23345  "\n" \
23346  " *buf_pos_in = buf_pos;\n" \
23347  " /* init liste des codes géographiques du bloc */\n" \
23348  " givrListParu.iNbr = 0;\n" \
23349  " givrListInst.iNbr = 0;\n" \
23350  " /* Sortie de la fonction */\n" \
23351  " return (iCodRet);\n" \
23352  "}\n" \
23353  "\n" \
23354  "/*----Fonction----------------------------------------------------------------*/\n" \
23355  "/* */\n" \
23356  "/* Fonction : givEcritContenu() */\n" \
23357  "/* */\n" \
23358  "/* But : ecrit les contenus SGIPRO */\n" \
23359  "/* */\n" \
23360  "/* */\n" \
23361  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
23362  "/* */\n" \
23363  "/* Sortie(s) : OK ou KO */\n" \
23364  "/* */\n" \
23365  "/* Portable : Transparent */\n" \
23366  "/* */\n" \
23367  "/* Modification (Jui/20/2006 - mb) : création de plusieurs fichiers de sortie */\n" \
23368  "/*----------------------------------------------------------------------------*/\n" \
23369  "\n" \
23370  "static int4 givEcritContenu(char* obj, char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice, int4* picvi)\n" \
23371  "\n" \
23372  "{\n" \
23373  " int4 lg_ecr_micro = 0;\n" \
23374  " int4 lg_ecr = 0;\n" \
23375  " int4 i, k, kk = 0;\n" \
23376  " int4 lg_write;\n" \
23377  " char* buf_pos, *buf_pos_ref;\n" \
23378  " char* pt_fin_liste;\n" \
23379  " char* pt_debut_element;\n" \
23380  " char* pt_fin_element;\n" \
23381  " char* pt_mil_element;\n" \
23382  " char* pt_suite_element;\n" \
23383  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
23384  " int4 iRet = GIV::GWCCodeKO; /* Code retour de la fonction */\n" \
23385  " char tcType[3 + 1];\n" \
23386  " char tcObj[3 + 1] = \"\";\n" \
23387  " char tcBalise[50 + 1];\n" \
23388  " int4 lg_a_ecrire;\n" \
23389  " int4 iRang, iObj, iRef, iMC, iBalise;\n" \
23390  " GYBrIamicT rIamic;\n" \
23391  " /* Pointeur sur debut du buffer */\n" \
23392  " buf_pos = *buf_pos_in;\n" \
23393  " /* Ecriture dans le fichier de sortie */\n" \
23394  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
23395  "\n" \
23396  " if (0 != strlen(obj))\n" \
23397  " {\n" \
23398  " strcpy(tcObj, obj);\n" \
23399  " tcObj[0] = toupper(tcObj[0]);\n" \
23400  " tcObj[1] = toupper(tcObj[1]);\n" \
23401  " }\n" \
23402  "\n" \
23403  " GWTTrace(GWT_NIV_FONCT, (\"Ecriture Contenu %s, %s\\n\", obj, tcObj));\n" \
23404  " pt_fin_liste = givtcObjCont + strlen(givtcObjCont);\n" \
23405  "\n" \
23406  " for (pt_debut_element = givtcObjCont; pt_debut_element < pt_fin_liste;)\n" \
23407  " {\n" \
23408  " pt_fin_element = strchr(pt_debut_element, ',');\n" \
23409  "\n" \
23410  " if (pt_fin_element == 0)\n" \
23411  " pt_fin_element = pt_fin_liste;\n" \
23412  "\n" \
23413  " pt_mil_element = strchr(pt_debut_element, '/');\n" \
23414  "\n" \
23415  " if (pt_mil_element == 0)\n" \
23416  " break;\n" \
23417  "\n" \
23418  " pt_suite_element = 0;\n" \
23419  " iRet = (int4)GIV::GIXCodeKO;\n" \
23420  " buf_pos_ref = buf_pos;\n" \
23421  "\n" \
23422  " while (pt_suite_element < pt_mil_element)\n" \
23423  " {\n" \
23424  " pt_suite_element = strchr(pt_debut_element, '|');\n" \
23425  "\n" \
23426  " if (pt_suite_element == 0 || pt_suite_element > pt_mil_element)\n" \
23427  " pt_suite_element = pt_mil_element;\n" \
23428  "\n" \
23429  " /* analyse type et balise associés */\n" \
23430  " /*memcpy(tcType, pt_debut_element, (pt_mil_element - pt_debut_element));*/\n" \
23431  " memcpy(tcType, pt_debut_element, (pt_suite_element - pt_debut_element));\n" \
23432  " tcType[(pt_mil_element - pt_debut_element)] = '\\0';\n" \
23433  " tcType[0] = toupper(tcType[0]);\n" \
23434  " tcType[1] = toupper(tcType[1]);\n" \
23435  " memcpy(tcBalise, (pt_mil_element + 1), (pt_fin_element - pt_mil_element - 1));\n" \
23436  " tcBalise[(pt_fin_element - pt_mil_element - 1)] = '\\0';\n" \
23437  " iRang = -1;\n" \
23438  " iRef = -1;\n" \
23439  " iMC = -1;\n" \
23440  " iBalise = GIV::GIXCodeKO;\n" \
23441  " GIVBuffInter[0] = '\\0';\n" \
23442  " GIVBuffClob[0] = '\\0';\n" \
23443  "\n" \
23444  " if ((0 != strlen(obj)) && (0 != strcmp(tcType, tcObj)) && ((int4)GIV::GIXCodeKO == iRet))\n" \
23445  " {\n" \
23446  " /* hors configuration prioritaire */\n" \
23447  " break;\n" \
23448  " }\n" \
23449  " else\n" \
23450  " for (i = 0; i < givrListObj.iNbr; i++)\n" \
23451  " {\n" \
23452  " GWTTrace(GWT_NIV_FONCT, (\"Ecriture Contenu %s, %s, %s\\n\", obj, tcObj, tcType));\n" \
23453  " k = givrListObj.trEltRangListObj[i];\n" \
23454  " kk = givrListObj.trEltListObj[k].iRgLigne;\n" \
23455  " iObj = givrListObj.trEltListObj[k].iRgObj;\n" \
23456  "\n" \
23457  " if ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].type, \"X\")) && (iRang != givrListObj.trEltListObj[k].iRangTri))\n" \
23458  " {\n" \
23459  " iRang = givrListObj.trEltListObj[k].iRangTri;\n" \
23460  " GWTTrace(GWT_NIV_FONCT, (\"Annonceur : %d,%d,%s\\n\", (doc + kk)->value.objets_pub.micro[iObj].iCVI, *picvi, (doc + kk)->value.objets_pub.micro[iObj].id));\n" \
23461  " GWTTrace(GWT_NIV_FONCT, (\"Objet Contenu %s, %s\\n\", (doc + kk)->value.objets_pub.micro[iObj].stype, (doc + kk)->value.objets_pub.micro[iObj].sstype));\n" \
23462  "\n" \
23463  " if ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"SC\")) && (0 != strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"PV\")))\n" \
23464  " {\n" \
23465  " /* contenu valide uniquement pour SC-PV */\n" \
23466  " continue;\n" \
23467  " }\n" \
23468  " else if ((0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"LC\")) && (0 != strcmp((doc + kk)->value.objets_pub.micro[iObj].sstype, \"CH\")))\n" \
23469  " {\n" \
23470  " /* contenu valide uniquement pour chronoresto LC-CH */\n" \
23471  " continue;\n" \
23472  " }\n" \
23473  "\n" \
23474  " if (0 == strcmp(tcType, (doc + kk)->value.objets_pub.micro[iObj].stype))\n" \
23475  " {\n" \
23476  " if (GIV::GIXCodeKO == *picvi && 2 == (doc + kk)->value.objets_pub.micro[iObj].iCVI)\n" \
23477  " {\n" \
23478  " /* nouveau CVI traité à part */\n" \
23479  " continue;\n" \
23480  " }\n" \
23481  "\n" \
23482  " if (GIV::GIXCodeKO != *picvi && 2 != (doc + kk)->value.objets_pub.micro[iObj].iCVI)\n" \
23483  " {\n" \
23484  " /* hors nouveau CVI traité à part */\n" \
23485  " continue;\n" \
23486  " }\n" \
23487  "\n" \
23488  " (doc + kk)->value.objets_pub.micro[iObj].iCont = 1;\n" \
23489  " }\n" \
23490  " else\n" \
23491  " continue;\n" \
23492  "\n" \
23493  " /* écriture SGIPRO */\n" \
23494  " if (0 == strcmp(tcObj, obj))\n" \
23495  " {\n" \
23496  " /* accès à un fichier */\n" \
23497  " if (GIV::GIXCodeKO == *picvi)\n" \
23498  " iCodRet = givEcritSgiPro(&buf_pos, doc, kk, iObj, indice, tcBalise, GIV::GIXCodeKO);\n" \
23499  " else if (GIV::GIXCodeOK == *picvi)\n" \
23500  " iCodRet = givEcritSgiPro(&buf_pos, doc, kk, iObj, indice, \"affcviv\", iRet);\n" \
23501  " else\n" \
23502  " {\n" \
23503  " /* nouvel objet CVI */\n" \
23504  " iCodRet = givEcritSgiPro(&buf_pos, doc, kk, iObj, indice, tcBalise, GIV::GIXCodeOK);\n" \
23505  " }\n" \
23506  " }\n" \
23507  " else\n" \
23508  " {\n" \
23509  " /* accès à la base */\n" \
23510  " if (0 == strcmp(\"MO\", (doc + kk)->value.objets_pub.micro[iObj].stype))\n" \
23511  " {\n" \
23512  " if ((0 != memcmp(&rIamic.acNumobj[4], &(doc + kk)->value.objets_pub.micro[iObj].id[4], 8)) && (0 != strlen(GIVBuffInter)))\n" \
23513  " {\n" \
23514  " GWTTrace(GWT_NIV_FONCT, (\"Ecriture Mots Cles 1 %d\\n\", iRef));\n" \
23515  "\n" \
23516  " if (GIV::GIXCodeKO == iBalise)\n" \
23517  " {\n" \
23518  " iCodRet = givEcritureMotsCles(&buf_pos, doc, iRef, iMC, indice, tcBalise);\n" \
23519  " iBalise = GIV::GIXCodeOK;\n" \
23520  " }\n" \
23521  " else\n" \
23522  " iCodRet = givEcritureMotsCles(&buf_pos, doc, iRef, iMC, indice, \"\");\n" \
23523  "\n" \
23524  " GIVBuffInter[0] = '\\0';\n" \
23525  " GIVBuffClob[0] = '\\0';\n" \
23526  " }\n" \
23527  "\n" \
23528  " (void)strcpy(rIamic.acNumobj, (doc + kk)->value.objets_pub.micro[iObj].id);\n" \
23529  " iCodRet = givLectureMotsCles(&rIamic);\n" \
23530  "\n" \
23531  " if (0 != strlen(GIVBuffInter))\n" \
23532  " {\n" \
23533  " iRef = kk;\n" \
23534  " iMC = iObj;\n" \
23535  " }\n" \
23536  " }\n" \
23537  " else if (GIV::GIXCodeKO == *picvi)\n" \
23538  " iCodRet = givEcritDonAnnonceur(&buf_pos, doc, kk, iObj, indice, tcBalise, GIV::GIXCodeKO);\n" \
23539  " else if (GIV::GIXCodeOK == *picvi)\n" \
23540  " iCodRet = givEcritDonAnnonceur(&buf_pos, doc, kk, iObj, indice, \"affcviv\", iRet);\n" \
23541  " else\n" \
23542  " {\n" \
23543  " /* nouvel objet CVI */\n" \
23544  " iCodRet = givEcritDonAnnonceur(&buf_pos, doc, kk, iObj, indice, tcBalise, GIV::GIXCodeOK);\n" \
23545  " }\n" \
23546  " }\n" \
23547  "\n" \
23548  " GWTTrace(GWT_NIV_FONCT, (\"En-tête 1 : %d,%d\\n\", iCodRet, iRet));\n" \
23549  "\n" \
23550  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
23551  " {\n" \
23552  " iRet = (int4)GIV::GIXCodeOK;\n" \
23553  "\n" \
23554  " if ((GIV::GIXCodeKO == *picvi) && (0 != strcmp(\"MO\", (doc + kk)->value.objets_pub.micro[iObj].stype)))\n" \
23555  " {\n" \
23556  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBalise);\n" \
23557  " buf_pos = buf_pos + lg_write;\n" \
23558  " }\n" \
23559  " }\n" \
23560  " else if ((int4)GIV::GIXCodeOK != iRet)\n" \
23561  " iRet = (int4)GIV::GIXCodeRIEN;\n" \
23562  "\n" \
23563  " if ((GIV::GIXCodeOK == *picvi) && ((int4)GIV::GIXCodeOK != iCodRet))\n" \
23564  " {\n" \
23565  " /* nouvel objet CVI sans contenu associé */\n" \
23566  " (doc + kk)->value.objets_pub.micro[iObj].iCVI = 3;\n" \
23567  " }\n" \
23568  "\n" \
23569  " GWTTrace(GWT_NIV_FONCT, (\"En-tête 2 : %d,%d\\n\", iCodRet, iRet));\n" \
23570  " }\n" \
23571  " } /* Fin boucle */\n" \
23572  "\n" \
23573  " GWTTrace(GWT_NIV_FONCT, (\"En-tête 3 : %d,%d\\n\", iRet, *picvi));\n" \
23574  "\n" \
23575  " if ((int4)GIV::GIXCodeOK == iRet)\n" \
23576  " {\n" \
23577  " if ((0 == strcmp(\"MO\", tcType)) && (0 != strlen(GIVBuffInter)))\n" \
23578  " {\n" \
23579  " GWTTrace(GWT_NIV_FONCT, (\"Ecriture Mots Cles 3 %d\\n\", iRef));\n" \
23580  "\n" \
23581  " if (GIV::GIXCodeKO == iBalise)\n" \
23582  " {\n" \
23583  " iCodRet = givEcritureMotsCles(&buf_pos, doc, iRef, iMC, indice, tcBalise);\n" \
23584  " iBalise = GIV::GIXCodeOK;\n" \
23585  " }\n" \
23586  " else\n" \
23587  " iCodRet = givEcritureMotsCles(&buf_pos, doc, iRef, iMC, indice, \"\");\n" \
23588  "\n" \
23589  " GIVBuffInter[0] = '\\0';\n" \
23590  " GIVBuffClob[0] = '\\0';\n" \
23591  " }\n" \
23592  "\n" \
23593  " if (GIV::GIXCodeOK == iBalise)\n" \
23594  " {\n" \
23595  " GWTTrace(GWT_NIV_FONCT, (\"Ecriture Mots Cles 4 %d\\n\", iRef));\n" \
23596  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBalise);\n" \
23597  " buf_pos = buf_pos + lg_write;\n" \
23598  " iBalise = GIV::GIXCodeKO;\n" \
23599  " }\n" \
23600  "\n" \
23601  " if (GIV::GIXCodeOK == *picvi)\n" \
23602  " *picvi = GIV::GIXCodeRIEN;\n" \
23603  "\n" \
23604  " pt_suite_element = pt_mil_element;\n" \
23605  " }\n" \
23606  " else if ((int4)GIV::GIXCodeRIEN == iRet)\n" \
23607  " pt_debut_element = pt_suite_element + 1;\n" \
23608  " else\n" \
23609  " pt_suite_element = pt_mil_element;\n" \
23610  " }\n" \
23611  "\n" \
23612  " pt_debut_element = pt_fin_element + 1;\n" \
23613  " }\n" \
23614  "\n" \
23615  " if ('\\0' != GIVBuffXML[0])\n" \
23616  " {\n" \
23617  " /* Ecriture dans le fichier de sortie */\n" \
23618  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
23619  " }\n" \
23620  "\n" \
23621  " *buf_pos_in = buf_pos;\n" \
23622  " GWTTrace(GWT_NIV_FONCT, (\"Sortie Ecriture Contenu\\n\"));\n" \
23623  " return (iCodRet);\n" \
23624  "}\n" \
23625  "\n" \
23626  "/*----Fonction----------------------------------------------------------------*/\n" \
23627  "/* */\n" \
23628  "/* Fonction : givEcritPart() */\n" \
23629  "/* */\n" \
23630  "/* But : ecrit les contenus SGIPRO de partenaires */\n" \
23631  "/* */\n" \
23632  "/* */\n" \
23633  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
23634  "/* */\n" \
23635  "/* Sortie(s) : OK ou KO */\n" \
23636  "/* */\n" \
23637  "/* Portable : Transparent */\n" \
23638  "/* */\n" \
23639  "/* Modification (Jui/20/2006 - mb) : création de plusieurs fichiers de sortie */\n" \
23640  "/*----------------------------------------------------------------------------*/\n" \
23641  "\n" \
23642  "static int4 givEcritPart(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice)\n" \
23643  "\n" \
23644  "{\n" \
23645  " int4 lg_ecr_micro = 0;\n" \
23646  " int4 lg_ecr = 0;\n" \
23647  " int4 i, q = 0;\n" \
23648  " int4 lg_write;\n" \
23649  " int4 iDebut;\n" \
23650  " char* buf_pos;\n" \
23651  " char* buf_pos_part;\n" \
23652  " char* pt_fin_liste;\n" \
23653  " char* pt_debut_element;\n" \
23654  " char* pt_fin_element;\n" \
23655  " char* pt_suite_element;\n" \
23656  " char* pt_mil_element;\n" \
23657  " char* pt_fin_lst;\n" \
23658  " char* pt_debut;\n" \
23659  " char* pt_fin;\n" \
23660  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
23661  " char tcType[3 + 1];\n" \
23662  " char tcTYPE[3 + 1];\n" \
23663  " char tcBalise[50 + 1];\n" \
23664  " char tcBalises[50 + 2];\n" \
23665  " char tcElmt[29 + 1]; /* partenaire*/\n" \
23666  " int4 lg_a_ecrire;\n" \
23667  " int4 pipe; /* Flag pour ajout pipe */\n" \
23668  " int4 iRet;\n" \
23669  " /* pas de gestion de conflit */\n" \
23670  " giviConflitCRC = GIV::GWCCodeKO;\n" \
23671  " /* Pointeur sur debut du buffer */\n" \
23672  " buf_pos = *buf_pos_in;\n" \
23673  " /* Ecriture dans le fichier de sortie */\n" \
23674  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
23675  " *buf_pos_in = buf_pos;\n" \
23676  " pt_fin_liste = givtcObjCont + strlen(givtcObjCont);\n" \
23677  "\n" \
23678  " for (pt_debut_element = givtcObjCont; pt_debut_element < pt_fin_liste;)\n" \
23679  " {\n" \
23680  " pt_fin_element = strchr(pt_debut_element, ',');\n" \
23681  "\n" \
23682  " if (pt_fin_element == 0)\n" \
23683  " pt_fin_element = pt_fin_liste;\n" \
23684  "\n" \
23685  " pt_mil_element = strchr(pt_debut_element, '/');\n" \
23686  "\n" \
23687  " if (pt_mil_element == 0)\n" \
23688  " break;\n" \
23689  "\n" \
23690  " /* analyse premier type et balise associés */\n" \
23691  " pt_suite_element = strchr(pt_debut_element, '|');\n" \
23692  "\n" \
23693  " if ((pt_suite_element != 0) && (pt_suite_element < pt_mil_element))\n" \
23694  " {\n" \
23695  " memcpy(tcType, pt_debut_element, (pt_suite_element - pt_debut_element));\n" \
23696  " tcType[(pt_suite_element - pt_debut_element)] = '\\0';\n" \
23697  " }\n" \
23698  " else\n" \
23699  " {\n" \
23700  " memcpy(tcType, pt_debut_element, (pt_mil_element - pt_debut_element));\n" \
23701  " tcType[(pt_mil_element - pt_debut_element)] = '\\0';\n" \
23702  " }\n" \
23703  "\n" \
23704  " strcpy(tcTYPE, tcType);\n" \
23705  " tcTYPE[0] = toupper(tcTYPE[0]);\n" \
23706  " tcTYPE[1] = toupper(tcTYPE[1]);\n" \
23707  " memcpy(tcBalise, (pt_mil_element + 1), (pt_fin_element - pt_mil_element - 1));\n" \
23708  " tcBalise[(pt_fin_element - pt_mil_element - 1)] = '\\0';\n" \
23709  " strcpy(tcBalises, tcBalise);\n" \
23710  " /* strcat(tcBalises,\"s\"); */\n" \
23711  "\n" \
23712  " if ((0 == strcmp(tcTYPE, \"DC\")) || (0 == strcmp(tcTYPE, \"RA\")))\n" \
23713  " {\n" \
23714  " /* enrichissement des partenaires */\n" \
23715  " /* écriture SGIPRO */\n" \
23716  " iDebut = 1;\n" \
23717  "\n" \
23718  " if ((0 != strlen(doc->value.a_classer.etab)) && (0 == strcmp(tcTYPE, \"DC\")))\n" \
23719  " {\n" \
23720  " /* établissement */\n" \
23721  " if (0 == strcmp(tcTYPE, tcType))\n" \
23722  " {\n" \
23723  " /* accès à un fichier */\n" \
23724  " iCodRet = givEcritSgiProPart(&buf_pos, doc, doc->value.a_classer.etab, doc->value.a_classer.etab, tcType, tcBalise, &iDebut);\n" \
23725  " }\n" \
23726  " else\n" \
23727  " {\n" \
23728  " /* accès à la base */\n" \
23729  " iCodRet = givEcritDonEtab(tcTYPE, tcBalise, &buf_pos, *buf_pos_in, doc, \"\", \"\", \"\", &iDebut);\n" \
23730  " }\n" \
23731  " }\n" \
23732  " else if ((0 != strlen(doc->value.a_classer.etab)) && (0 == strcmp(tcTYPE, \"RA\")))\n" \
23733  " {\n" \
23734  " if (0 == strcmp(tcTYPE, tcType))\n" \
23735  " {\n" \
23736  " /* accès à un fichier */\n" \
23737  " iCodRet = givEcritSgiProBOC(&buf_pos, doc, indice, doc->value.a_classer.etab, tcType, tcBalise);\n" \
23738  " }\n" \
23739  " else\n" \
23740  " {\n" \
23741  " /* accès à la base */\n" \
23742  " iCodRet = givEcritDonEtab(tcTYPE, tcBalise, &buf_pos, *buf_pos_in, doc, \"\", \"\", \"\", &iDebut);\n" \
23743  " }\n" \
23744  " }\n" \
23745  " }\n" \
23746  "\n" \
23747  " pt_debut_element = pt_fin_element + 1;\n" \
23748  " }\n" \
23749  "\n" \
23750  " if ('\\0' != GIVBuffXML[0])\n" \
23751  " {\n" \
23752  " /* Ecriture dans le fichier de sortie */\n" \
23753  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
23754  " }\n" \
23755  "\n" \
23756  " *buf_pos_in = buf_pos;\n" \
23757  " memset(buf_concat, 0, strlen(buf_concat));\n" \
23758  " GWTTrace(GWT_NIV_FONCT, (\"Sortie Ecriture Contenu\\n\"));\n" \
23759  " return (iCodRet);\n" \
23760  "}\n" \
23761  "\n" \
23762  "/*----Fonction----------------------------------------------------------------*/\n" \
23763  "/* */\n" \
23764  "/* Fonction : givAffCRCEtab */\n" \
23765  "/* */\n" \
23766  "/* But : liste des balises NORMALE par epj */\n" \
23767  "/* de l'ensemble du bloc */\n" \
23768  "/* */\n" \
23769  "/* Entree(s) : un buffer, documents */\n" \
23770  "/* */\n" \
23771  "/* Sortie(s) : OK ou KO */\n" \
23772  "/* */\n" \
23773  "/* Portable : Transparent */\n" \
23774  "/* */\n" \
23775  "/* Création (Oct/01/2012 - mb) */\n" \
23776  "/*----------------------------------------------------------------------------*/\n" \
23777  "\n" \
23778  "static int4 givAffCRCEtab(char** buf_pos_in)\n" \
23779  "\n" \
23780  "{\n" \
23781  " int4 lg_write, lg_ecr = 0;\n" \
23782  " int4 lg;\n" \
23783  " int4 i, j, k, l, p, q, r, rr;\n" \
23784  " char* buf_pos;\n" \
23785  " int4 iCodRet, iRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
23786  " char* pt_fin_lst;\n" \
23787  " char* pt_debut;\n" \
23788  " char* pt_fin;\n" \
23789  " char tcElmt[GYBLgPrioCRC2]; /* CRC normale */\n" \
23790  " GYBrPrioCRCT rPrioCRC;\n" \
23791  " int4 iNbEtabCRC, iNbCRCCRC;\n" \
23792  " int4 iRgEtabCRC, iRgCRCCRC;\n" \
23793  " int4 iRgEtab, iRgCRC;\n" \
23794  " int4 iRangDeb;\n" \
23795  " int4 iBLEtab;\n" \
23796  "\n" \
23797  " if (0 == giviNbCRC)\n" \
23798  " {\n" \
23799  " /* pas de nouveau CRC */\n" \
23800  " return (iCodRet);\n" \
23801  " }\n" \
23802  "\n" \
23803  " givrListCRC.iNbr = giviNbCRC;\n" \
23804  "\n" \
23805  " for (i = 0; i < givrListCRC.iNbr; i++)\n" \
23806  " {\n" \
23807  " p = givrListCRC.trEltRangList[i];\n" \
23808  " GWTTrace(GWT_NIV_FONCT, (\"crc init : %d,%d,%d,%s\\n\", givrListCRC.iNbr, i, p, givrListCRC.trEltList[p].acEtab));\n" \
23809  " }\n" \
23810  "\n" \
23811  " /* trier en fonction des crc */\n" \
23812  " qsort(givrListCRC.trEltRangList, givrListCRC.iNbr, sizeof(int4), givCompListCRC);\n" \
23813  "\n" \
23814  " /* suppression autres crc sans epj */\n" \
23815  " for (i = 0; i < giviNbCRC; i++)\n" \
23816  " {\n" \
23817  " p = givrListCRC.trEltRangList[i];\n" \
23818  "\n" \
23819  " if (0 == strlen(givrListCRC.trEltList[p].acEtab))\n" \
23820  " break;\n" \
23821  " }\n" \
23822  "\n" \
23823  " if (0 != i)\n" \
23824  " givrListCRC.iNbr = i;\n" \
23825  "\n" \
23826  " /* référence courante */\n" \
23827  " (void)strcpy(rPrioCRC.acEtab, \"00000000\");\n" \
23828  " (void)strcpy(rPrioCRC.acCodan8, \"\");\n" \
23829  " iRgEtab = -1;\n" \
23830  " iRgCRC = -1;\n" \
23831  " iBLEtab = -1;\n" \
23832  "\n" \
23833  " /* rang de chaque etab et de chaque crc */\n" \
23834  " for (i = 0; i < givrListCRC.iNbr; i++)\n" \
23835  " {\n" \
23836  " p = givrListCRC.trEltRangList[i];\n" \
23837  "\n" \
23838  " if ((0 != strcmp(rPrioCRC.acEtab, givrListCRC.trEltList[p].acEtab)) || (0 == i))\n" \
23839  " {\n" \
23840  " iRgEtab++;\n" \
23841  " iRgCRC = 0;\n" \
23842  " }\n" \
23843  " else if (0 != strcmp(rPrioCRC.acCodan8, givrListCRC.trEltList[p].acCodan8))\n" \
23844  " iRgCRC++;\n" \
23845  "\n" \
23846  " givrListCRC.trEltList[p].iRgEtab = iRgEtab;\n" \
23847  " givrListCRC.trEltList[p].iRgCRC = iRgCRC;\n" \
23848  "\n" \
23849  " if (((0 != strcmp(rPrioCRC.acEtab, givrListCRC.trEltList[p].acEtab)) || (0 == i)) && (0 != strlen(givrListCRC.trEltList[p].acEtab)))\n" \
23850  " {\n" \
23851  " /* analyse du black-listage en fiche détaillée sur EPJ */\n" \
23852  " iCodRet = givLectureBListEPJFD(givrListCRC.trEltList[p].acEtab);\n" \
23853  "\n" \
23854  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
23855  " {\n" \
23856  " givrListCRC.trEltList[p].iRgEtab = -1;\n" \
23857  " givrListCRC.trEltList[p].iRgCRC = -1;\n" \
23858  " iBLEtab = 0;\n" \
23859  " }\n" \
23860  " else\n" \
23861  " iBLEtab = -1;\n" \
23862  " }\n" \
23863  " else if ((0 == strcmp(rPrioCRC.acEtab, givrListCRC.trEltList[p].acEtab)) && (0 == strcmp(rPrioCRC.acTpdsob, givrListCRC.trEltList[p].acTpdsob))\n" \
23864  " && (0 == strcmp(rPrioCRC.acCRC, givrListCRC.trEltList[p].acCRC)) && (0 == strcmp(rPrioCRC.acCodan8, givrListCRC.trEltList[p].acCodan8))\n" \
23865  " && (0 == strcmp(rPrioCRC.acType, givrListCRC.trEltList[p].acType)))\n" \
23866  " {\n" \
23867  " /* crc en double */\n" \
23868  " givrListCRC.trEltList[p].iRgEtab = -1;\n" \
23869  " givrListCRC.trEltList[p].iRgCRC = -1;\n" \
23870  " }\n" \
23871  " else if ((0 == strcmp(rPrioCRC.acEtab, givrListCRC.trEltList[p].acEtab)) && (0 == iBLEtab))\n" \
23872  " {\n" \
23873  " /* bl sur même epj */\n" \
23874  " givrListCRC.trEltList[p].iRgEtab = -1;\n" \
23875  " givrListCRC.trEltList[p].iRgCRC = -1;\n" \
23876  " }\n" \
23877  "\n" \
23878  " strcpy(rPrioCRC.acEtab, givrListCRC.trEltList[p].acEtab);\n" \
23879  " strcpy(rPrioCRC.acTpdsob, givrListCRC.trEltList[p].acTpdsob);\n" \
23880  " strcpy(rPrioCRC.acCRC, givrListCRC.trEltList[p].acCRC);\n" \
23881  " strcpy(rPrioCRC.acCodan8, givrListCRC.trEltList[p].acCodan8);\n" \
23882  " strcpy(rPrioCRC.acType, givrListCRC.trEltList[p].acType);\n" \
23883  " }\n" \
23884  "\n" \
23885  " iNbEtabCRC = 0;\n" \
23886  " iRgEtab = 0;\n" \
23887  " iRangDeb = 0;\n" \
23888  "\n" \
23889  " /* rang dans chaque etab */\n" \
23890  " for (j = 0; j < (givrListCRC.iNbr); j++)\n" \
23891  " {\n" \
23892  " i = givrListCRC.trEltRangList[j];\n" \
23893  "\n" \
23894  " if ((iRgEtab != givrListCRC.trEltList[i].iRgEtab) && (-1 != givrListCRC.trEltList[i].iRgEtab))\n" \
23895  " {\n" \
23896  " iRgEtabCRC = 0;\n" \
23897  "\n" \
23898  " for (l = iRangDeb; l < j; l++)\n" \
23899  " {\n" \
23900  " k = givrListCRC.trEltRangList[l];\n" \
23901  " givrListCRC.trEltList[k].iNbEtabCRC = iNbEtabCRC;\n" \
23902  " givrListCRC.trEltList[k].iRgEtabCRC = iRgEtabCRC;\n" \
23903  " givrListCRC.trEltList[k].iNbCRCCRC = 1;\n" \
23904  " givrListCRC.trEltList[k].iRgCRCCRC = 0;\n" \
23905  " iRgEtabCRC++;\n" \
23906  " }\n" \
23907  "\n" \
23908  " iRgEtab = givrListCRC.trEltList[i].iRgEtab;\n" \
23909  " iNbEtabCRC = 0;\n" \
23910  " iRangDeb = j;\n" \
23911  " }\n" \
23912  "\n" \
23913  " iNbEtabCRC++;\n" \
23914  "\n" \
23915  " if ((givrListCRC.iNbr - 1) == j)\n" \
23916  " {\n" \
23917  " iRgEtabCRC = 0;\n" \
23918  "\n" \
23919  " for (l = iRangDeb; l < (givrListCRC.iNbr); l++)\n" \
23920  " {\n" \
23921  " k = givrListCRC.trEltRangList[l];\n" \
23922  " givrListCRC.trEltList[k].iNbEtabCRC = iNbEtabCRC;\n" \
23923  " givrListCRC.trEltList[k].iRgEtabCRC = iRgEtabCRC;\n" \
23924  " givrListCRC.trEltList[k].iNbCRCCRC = 1;\n" \
23925  " givrListCRC.trEltList[k].iRgCRCCRC = 0;\n" \
23926  " iRgEtabCRC++;\n" \
23927  " }\n" \
23928  " }\n" \
23929  " }\n" \
23930  "\n" \
23931  " /* rang dans chaque crc */\n" \
23932  " iNbCRCCRC = 0;\n" \
23933  " iRgEtab = 0;\n" \
23934  " iRgCRC = 0;\n" \
23935  " iRangDeb = 0;\n" \
23936  "\n" \
23937  " for (j = 0; j < (givrListCRC.iNbr); j++)\n" \
23938  " {\n" \
23939  " i = givrListCRC.trEltRangList[j];\n" \
23940  "\n" \
23941  " if (((iRgEtab != givrListCRC.trEltList[i].iRgEtab) || (iRgCRC != givrListCRC.trEltList[i].iRgCRC)) && (-1 != givrListCRC.trEltList[i].iRgEtab) && (-1 != givrListCRC.trEltList[i].iRgCRC))\n" \
23942  " {\n" \
23943  " iRgCRCCRC = 0;\n" \
23944  "\n" \
23945  " for (l = iRangDeb; l < j; l++)\n" \
23946  " {\n" \
23947  " k = givrListCRC.trEltRangList[l];\n" \
23948  " givrListCRC.trEltList[k].iNbCRCCRC = iNbCRCCRC;\n" \
23949  " givrListCRC.trEltList[k].iRgCRCCRC = iRgCRCCRC;\n" \
23950  " iRgCRCCRC++;\n" \
23951  " }\n" \
23952  "\n" \
23953  " iRgEtab = givrListCRC.trEltList[i].iRgEtab;\n" \
23954  " iRgCRC = givrListCRC.trEltList[i].iRgCRC;\n" \
23955  " iNbCRCCRC = 0;\n" \
23956  " iRangDeb = j;\n" \
23957  " }\n" \
23958  "\n" \
23959  " iNbCRCCRC++;\n" \
23960  "\n" \
23961  " if ((givrListCRC.iNbr - 1) == j)\n" \
23962  " {\n" \
23963  " iRgCRCCRC = 0;\n" \
23964  "\n" \
23965  " for (l = iRangDeb; l < (givrListCRC.iNbr); l++)\n" \
23966  " {\n" \
23967  " k = givrListCRC.trEltRangList[l];\n" \
23968  " givrListCRC.trEltList[k].iNbCRCCRC = iNbCRCCRC;\n" \
23969  " givrListCRC.trEltList[k].iRgCRCCRC = iRgCRCCRC;\n" \
23970  " iRgCRCCRC++;\n" \
23971  " }\n" \
23972  " }\n" \
23973  " }\n" \
23974  "\n" \
23975  " for (i = 0; i < givrListCRC.iNbr; i++)\n" \
23976  " {\n" \
23977  " p = givrListCRC.trEltRangList[i];\n" \
23978  " GWTTrace(GWT_NIV_FONCT, (\"crc : %d,%d,%d,%d,%d,%d,%d,%d,%d,%d\\n\", givrListCRC.iNbr, p, givrListCRC.trEltList[p].iRgEtab, givrListCRC.trEltList[p].iRgCRC, givrListCRC.trEltList[p].iNbEtabCRC,\n" \
23979  " givrListCRC.trEltList[p].iRgEtabCRC, givrListCRC.trEltList[p].iNbCRCCRC, givrListCRC.trEltList[p].iRgCRCCRC));\n" \
23980  " }\n" \
23981  "\n" \
23982  " if (0 != strcmp(\"OUI\", givtcGeneAffCRC))\n" \
23983  " {\n" \
23984  " /* pas d'affichage de CRC */\n" \
23985  " return (iCodRet);\n" \
23986  " }\n" \
23987  "\n" \
23988  " /* Initialisation pointeur */\n" \
23989  " buf_pos = *buf_pos_in;\n" \
23990  " /* référence courante */\n" \
23991  " (void)strcpy(rPrioCRC.acEtab, \"00000000\");\n" \
23992  " (void)strcpy(rPrioCRC.acCRC, \"\");\n" \
23993  "\n" \
23994  " for (i = 0; i < givrListCRC.iNbr;)\n" \
23995  " {\n" \
23996  " p = givrListCRC.trEltRangList[i];\n" \
23997  "\n" \
23998  " /* changement d'etab */\n" \
23999  " if ((-1 == givrListCRC.trEltList[p].iRgEtab) || (-1 == givrListCRC.trEltList[p].iRgCRC))\n" \
24000  " {\n" \
24001  " /* bl sur epj complet */\n" \
24002  " i += givrListCRC.trEltList[p].iNbEtabCRC;\n" \
24003  " continue;\n" \
24004  " }\n" \
24005  "\n" \
24006  " for (j = i; (j < i + givrListCRC.trEltList[p].iNbEtabCRC);)\n" \
24007  " {\n" \
24008  " q = givrListCRC.trEltRangList[j];\n" \
24009  " /* changement de CRC */\n" \
24010  " strcat(buf_pos, \"<CRC crcan8=\\\"\");\n" \
24011  "\n" \
24012  " if (0 != strcmp(givcR000000, givrListCRC.trEltList[q].acCodan8))\n" \
24013  " strcat(buf_pos, givrListCRC.trEltList[q].acCodan8);\n" \
24014  "\n" \
24015  " strcat(buf_pos, \"\\\">\");\n" \
24016  " lg_ecr = strlen(buf_pos);\n" \
24017  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24018  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24019  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24020  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24021  " rr = -1;\n" \
24022  "\n" \
24023  " for (k = j; (k < j + givrListCRC.trEltList[q].iNbCRCCRC); k++)\n" \
24024  " {\n" \
24025  " /* même CRC */\n" \
24026  " r = givrListCRC.trEltRangList[k];\n" \
24027  "\n" \
24028  " if ((-1 == givrListCRC.trEltList[r].iRgEtab) || (-1 == givrListCRC.trEltList[r].iRgCRC))\n" \
24029  " {\n" \
24030  " /* double */\n" \
24031  " continue;\n" \
24032  " }\n" \
24033  "\n" \
24034  " /* crc et type */\n" \
24035  " if ((-1 != rr) && ((0 != strcmp(givrListCRC.trEltList[r].acType, givrListCRC.trEltList[rr].acType)) || (0 != strcmp(givrListCRC.trEltList[r].acCRC, givrListCRC.trEltList[rr].acCRC))))\n" \
24036  " {\n" \
24037  " strcat(buf_pos, \"</origine>\");\n" \
24038  " lg_ecr = strlen(buf_pos);\n" \
24039  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24040  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24041  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24042  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24043  " strcat(buf_pos, \"</CRC>\");\n" \
24044  " lg_ecr = strlen(buf_pos);\n" \
24045  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24046  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24047  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24048  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24049  " }\n" \
24050  "\n" \
24051  " if ((-1 == rr) || (0 != strcmp(givrListCRC.trEltList[r].acType, givrListCRC.trEltList[rr].acType)) || (0 != strcmp(givrListCRC.trEltList[r].acCRC, givrListCRC.trEltList[rr].acCRC)))\n" \
24052  " {\n" \
24053  " strcat(buf_pos, \"<CRC crctype=\\\"\");\n" \
24054  " strcat(buf_pos, givrListCRC.trEltList[r].acType);\n" \
24055  " strcat(buf_pos, \"\\\">\");\n" \
24056  " strcat(buf_pos, givrListCRC.trEltList[r].acCRC);\n" \
24057  " lg_ecr = strlen(buf_pos);\n" \
24058  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24059  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24060  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24061  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24062  " strcat(buf_pos, \"<origine>\");\n" \
24063  " lg_ecr = strlen(buf_pos);\n" \
24064  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24065  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24066  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24067  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24068  " }\n" \
24069  "\n" \
24070  " strcat(buf_pos, \"<origine>\");\n" \
24071  "\n" \
24072  " if (' ' == givrListCRC.trEltList[r].acTpdsob[0])\n" \
24073  " strcat(buf_pos, &givrListCRC.trEltList[r].acTpdsob[1]);\n" \
24074  " else\n" \
24075  " strcat(buf_pos, givrListCRC.trEltList[r].acTpdsob);\n" \
24076  "\n" \
24077  " strcat(buf_pos, \"</origine>\");\n" \
24078  " lg_ecr = strlen(buf_pos);\n" \
24079  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24080  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24081  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24082  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24083  " rr = r;\n" \
24084  " }\n" \
24085  "\n" \
24086  " strcat(buf_pos, \"</origine>\");\n" \
24087  " lg_ecr = strlen(buf_pos);\n" \
24088  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24089  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24090  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24091  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24092  " strcat(buf_pos, \"</CRC>\");\n" \
24093  " lg_ecr = strlen(buf_pos);\n" \
24094  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24095  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24096  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24097  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24098  " /* CRC suivant */\n" \
24099  " j = k;\n" \
24100  " /* fin des crc */\n" \
24101  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"CRC\");\n" \
24102  " buf_pos = buf_pos + lg_write;\n" \
24103  " }\n" \
24104  "\n" \
24105  " /* fin d'établissement */\n" \
24106  " /* établissement suivant */\n" \
24107  " i = j;\n" \
24108  " }\n" \
24109  "\n" \
24110  " /* fin des crc */\n" \
24111  " *buf_pos_in = buf_pos;\n" \
24112  " return (iCodRet);\n" \
24113  "}\n" \
24114  "\n" \
24115  "/*----Fonction----------------------------------------------------------------*/\n" \
24116  "/* */\n" \
24117  "/* Fonction : givMutualiserDonPartenaires */\n" \
24118  "/* */\n" \
24119  "/* But : mutualisation des contenus SGIPRO des partenaires */\n" \
24120  "/* de l'ensemble du bloc */\n" \
24121  "/* */\n" \
24122  "/* Entree(s) : un buffer, documents */\n" \
24123  "/* */\n" \
24124  "/* Sortie(s) : OK ou KO */\n" \
24125  "/* */\n" \
24126  "/* Portable : Transparent */\n" \
24127  "/* */\n" \
24128  "/* Création (Jan/09/2012 - mb) */\n" \
24129  "/*----------------------------------------------------------------------------*/\n" \
24130  "\n" \
24131  "static int4 givMutualiserDonPartenaires(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice)\n" \
24132  "\n" \
24133  "{\n" \
24134  " int4 lg_ecr_micro = 0;\n" \
24135  " int4 lg_ecr = 0;\n" \
24136  " int4 i, j, q = 0;\n" \
24137  " int4 lg_write;\n" \
24138  " int4 iDebut;\n" \
24139  " char* buf_pos;\n" \
24140  " char* pt_fin_liste;\n" \
24141  " char* pt_debut_element;\n" \
24142  " char* pt_fin_element;\n" \
24143  " char* pt_mil_element;\n" \
24144  " char* pt_fin_lst;\n" \
24145  " char* pt_debut;\n" \
24146  " char* pt_fin;\n" \
24147  " char* pt_mil;\n" \
24148  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
24149  " char tcBalise[50 + 1];\n" \
24150  " char tcBalises[50 + 2];\n" \
24151  " char tcElmt1[29 + 1]; /* partenaire*/\n" \
24152  " char tcElmt0[9 + 1]; /* établissement*/\n" \
24153  " char tcEtab[9 + 1]; /* établissement lié à doc */\n" \
24154  " char tcType[3];\n" \
24155  " int4 lg_a_ecrire;\n" \
24156  " int4 pipe; /* Flag pour ajout pipe */\n" \
24157  " int4 iRet;\n" \
24158  " pt_fin_liste = givtcObjCont + strlen(givtcObjCont);\n" \
24159  " strcpy(tcType, \"pr\");\n" \
24160  " pt_debut_element = strstr(givtcObjCont, \"pr/\");\n" \
24161  "\n" \
24162  " if (0 == pt_debut_element)\n" \
24163  " {\n" \
24164  " strcpy(tcType, \"PR\");\n" \
24165  " pt_debut_element = strstr(givtcObjCont, \"PR/\");\n" \
24166  "\n" \
24167  " if (0 == pt_debut_element)\n" \
24168  " return (iCodRet);\n" \
24169  " }\n" \
24170  "\n" \
24171  " /* pas de gestion de conflit */\n" \
24172  " giviConflitCRC = GIV::GWCCodeKO;\n" \
24173  " /* ref de partenaire des doubles */\n" \
24174  " memset(buf_concat, 0, strlen(buf_concat));\n" \
24175  " pipe = 0;\n" \
24176  "\n" \
24177  " for (i = 0; i < indice; i++)\n" \
24178  " {\n" \
24179  " for (q = 0; (q < doc[i].value.a_classer.iNbPart && 0 != strlen(doc[i].value.a_classer.etab)); q++)\n" \
24180  " {\n" \
24181  " if (pipe == 0)\n" \
24182  " {\n" \
24183  " strcpy(buf_concat, doc[i].value.a_classer.trpart[q].rpart);\n" \
24184  " strcat(buf_concat, \".\");\n" \
24185  " strcat(buf_concat, doc[i].value.a_classer.etab);\n" \
24186  " pipe = 1;\n" \
24187  " }\n" \
24188  " else\n" \
24189  " {\n" \
24190  " strcat(buf_concat, \"|\");\n" \
24191  " strcat(buf_concat, doc[i].value.a_classer.trpart[q].rpart);\n" \
24192  " strcat(buf_concat, \".\");\n" \
24193  " strcat(buf_concat, doc[i].value.a_classer.etab);\n" \
24194  " }\n" \
24195  " }\n" \
24196  "\n" \
24197  " /* suppression des doubles références */\n" \
24198  " iRet = supprimer_doublon(buf_concat, '|');\n" \
24199  " }\n" \
24200  "\n" \
24201  " GWTTrace(GWT_NIV_FONCT, (\"Ref partenaire pour DonPart %s,'%s'\\n\", doc[0].value.a_classer.etab, buf_concat));\n" \
24202  "\n" \
24203  " if (0 == strlen(buf_concat))\n" \
24204  " return (iCodRet);\n" \
24205  "\n" \
24206  " /* Pointeur sur debut du buffer */\n" \
24207  " buf_pos = *buf_pos_in;\n" \
24208  "\n" \
24209  " /* Ecriture dans le fichier de sortie */\n" \
24210  " if ('\\0' != GIVBuffXML[0])\n" \
24211  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
24212  "\n" \
24213  " *buf_pos_in = buf_pos;\n" \
24214  " pt_fin_element = strchr(pt_debut_element, ',');\n" \
24215  "\n" \
24216  " if (pt_fin_element == 0)\n" \
24217  " pt_fin_element = pt_fin_liste;\n" \
24218  "\n" \
24219  " pt_mil_element = pt_debut_element + 2;\n" \
24220  " /* analyse type et balise associés */\n" \
24221  " memcpy(tcBalise, (pt_mil_element + 1), (pt_fin_element - pt_mil_element - 1));\n" \
24222  " tcBalise[(pt_fin_element - pt_mil_element - 1)] = '\\0';\n" \
24223  " strcpy(tcBalises, tcBalise);\n" \
24224  " /* strcat(tcBalises,\"s\"); */\n" \
24225  " /* enrichissement des partenaires */\n" \
24226  " /* écriture SGIPRO */\n" \
24227  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
24228  " iDebut = 1;\n" \
24229  " pt_fin_lst = buf_concat + strlen(buf_concat);\n" \
24230  "\n" \
24231  " for (pt_debut = buf_concat; pt_debut < pt_fin_lst;)\n" \
24232  " {\n" \
24233  " pt_fin = strchr(pt_debut, '|');\n" \
24234  "\n" \
24235  " if (pt_fin == 0)\n" \
24236  " pt_fin = pt_fin_lst;\n" \
24237  "\n" \
24238  " pt_mil = strchr(pt_debut, '.');\n" \
24239  "\n" \
24240  " if (pt_mil == 0)\n" \
24241  " return (iCodRet);\n" \
24242  "\n" \
24243  " /* analyse référence */\n" \
24244  " memcpy(tcElmt1, pt_debut, (pt_mil - pt_debut));\n" \
24245  " tcElmt1[(pt_mil - pt_debut)] = '\\0';\n" \
24246  " pt_mil++;\n" \
24247  " memcpy(tcElmt0, pt_mil, (pt_fin - pt_mil));\n" \
24248  " tcElmt0[(pt_fin - pt_mil)] = '\\0';\n" \
24249  " /* rétablir cohérence entre etab et doc */\n" \
24250  " strcpy(tcEtab, doc[0].value.a_classer.etab);\n" \
24251  " strcpy(doc[0].value.a_classer.etab, tcElmt0);\n" \
24252  "\n" \
24253  " if (0 == strcmp(tcType, \"pr\"))\n" \
24254  " iCodRet = givEcritSgiProPartEtab(&buf_pos, doc, indice, tcElmt0, tcElmt1, \"PR\", tcBalise, &iDebut);\n" \
24255  " else\n" \
24256  " iCodRet = givEcritSgiProPart(&buf_pos, doc, tcElmt0, tcElmt1, \"PR\", tcBalise, &iDebut);\n" \
24257  "\n" \
24258  " strcpy(doc[0].value.a_classer.etab, tcEtab);\n" \
24259  " pt_debut = pt_fin + 1;\n" \
24260  " }\n" \
24261  "\n" \
24262  " if ('\\0' != GIVBuffXML[0])\n" \
24263  " {\n" \
24264  " /* Ecriture dans le fichier de sortie */\n" \
24265  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
24266  " }\n" \
24267  "\n" \
24268  " for (i = doc[0].value.a_classer.iNbPart; i < doc[0].value.a_classer.iNbPart + giviNbIapartPJDC; i++)\n" \
24269  " {\n" \
24270  " /* référence de partenaire PJDC non intégrée */\n" \
24271  " j = doc[0].value.a_classer.trpart[i].iRgParent;\n" \
24272  " strcat(buf_pos, cComm_xml0);\n" \
24273  " strcat(buf_pos, givtrPart[j].acRefPart);\n" \
24274  " strcat(buf_pos, \" - \");\n" \
24275  "\n" \
24276  " if (0 != strlen(givtrPart[j].acPrenom))\n" \
24277  " {\n" \
24278  " strcat(buf_pos, givtrPart[j].acPrenom);\n" \
24279  " strcat(buf_pos, \" \");\n" \
24280  " }\n" \
24281  "\n" \
24282  " strcat(buf_pos, givtrPart[j].acDenom);\n" \
24283  " strcat(buf_pos, cComm_xml1);\n" \
24284  " lg_ecr = strlen(buf_pos);\n" \
24285  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24286  " *(buf_pos + lg_ecr + 1) = LINE_FEED;\n" \
24287  " *(buf_pos + lg_ecr + 2) = '\\0';\n" \
24288  " buf_pos = buf_pos + strlen(buf_pos);\n" \
24289  " }\n" \
24290  "\n" \
24291  " if (0 != strlen(buf_concat))\n" \
24292  " {\n" \
24293  " pt_fin_lst = buf_concat + strlen(buf_concat);\n" \
24294  "\n" \
24295  " for (pt_debut = buf_concat; pt_debut < pt_fin_lst;)\n" \
24296  " {\n" \
24297  " pt_fin = strchr(pt_debut, '|');\n" \
24298  "\n" \
24299  " if (pt_fin == 0)\n" \
24300  " pt_fin = pt_fin_lst;\n" \
24301  "\n" \
24302  " pt_mil = strchr(pt_debut, '.');\n" \
24303  "\n" \
24304  " if (pt_mil == 0)\n" \
24305  " return (iCodRet);\n" \
24306  "\n" \
24307  " /* référence de partenaire */\n" \
24308  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"infos_part\");\n" \
24309  " buf_pos = buf_pos + lg_write;\n" \
24310  " memcpy(tcElmt1, pt_debut, (pt_mil - pt_debut));\n" \
24311  " tcElmt1[(pt_mil - pt_debut)] = '\\0';\n" \
24312  " iRet = giv_ecrit_noeud_partenaire(&buf_pos, tcElmt1, doc->value.numero_bloc_parution, doc->value.a_classer.etab);\n" \
24313  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"infos_part\");\n" \
24314  " buf_pos = buf_pos + lg_write;\n" \
24315  " pt_debut = pt_fin + 1;\n" \
24316  " }\n" \
24317  " }\n" \
24318  "\n" \
24319  " *buf_pos_in = buf_pos;\n" \
24320  " memset(buf_concat, 0, strlen(buf_concat));\n" \
24321  " GWTTrace(GWT_NIV_FONCT, (\"Sortie Ecriture DonPartenaires\\n\"));\n" \
24322  " return (iCodRet);\n" \
24323  "}\n" \
24324  "\n" \
24325  "/*----Fonction----------------------------------------------------------------*/\n" \
24326  "/* */\n" \
24327  "/* Fonction : givEcritDonAdd() */\n" \
24328  "/* */\n" \
24329  "/* But : ecrit les données additionnelles liées à l'établissement */\n" \
24330  "/* lecture xmltype via clob */\n" \
24331  "/* */\n" \
24332  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
24333  "/* */\n" \
24334  "/* Sortie(s) : OK ou KO */\n" \
24335  "/* */\n" \
24336  "/* Portable : Transparent */\n" \
24337  "/* */\n" \
24338  "/* Modification () : */\n" \
24339  "/*----------------------------------------------------------------------------*/\n" \
24340  "\n" \
24341  "static int4 givEcritDonAdd(char* apcType, char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice)\n" \
24342  "\n" \
24343  "{\n" \
24344  " int4 lg_ecr_micro = 0;\n" \
24345  " int4 lg_ecr = 0;\n" \
24346  " int4 i = 0;\n" \
24347  " int4 k, x = 0;\n" \
24348  " int4 iDebut = 1;\n" \
24349  " int4 lg_write;\n" \
24350  " char* buf_pos;\n" \
24351  " char* pt_debut_element;\n" \
24352  " char* pt_fin_element, *pt_mil_element, *pt_fin_liste;\n" \
24353  " char tcObj[GYBIamicLgNumobj2];\n" \
24354  " char tcSource[5 + 1];\n" \
24355  " char tcConf[3 + 1];\n" \
24356  " char tcBalise[50 + 1];\n" \
24357  " int4 iCodRet, iRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
24358  " int4 lg_a_ecrire;\n" \
24359  " char tcRef[3];\n" \
24360  " char tcType[3];\n" \
24361  " /* Pointeur sur debut du buffer */\n" \
24362  " buf_pos = *buf_pos_in;\n" \
24363  " /* balises configurées */\n" \
24364  " strcpy(tcRef, \"DA\");\n" \
24365  " strcpy(tcType, apcType);\n" \
24366  "\n" \
24367  " if (0 != strcmp(tcRef, apcType))\n" \
24368  " {\n" \
24369  " strcpy(tcConf, apcType);\n" \
24370  " strcat(tcConf, \"/\");\n" \
24371  " pt_debut_element = strstr(givtcObjCont, tcConf);\n" \
24372  "\n" \
24373  " if (0 == pt_debut_element)\n" \
24374  " {\n" \
24375  " tcType[0] = tolower(apcType[0]);\n" \
24376  " tcType[1] = tolower(apcType[1]);\n" \
24377  " strcpy(tcConf, tcType);\n" \
24378  " strcat(tcConf, \"/\");\n" \
24379  " pt_debut_element = strstr(givtcObjCont, tcConf);\n" \
24380  "\n" \
24381  " if (0 == pt_debut_element)\n" \
24382  " {\n" \
24383  " GWTTrace(GWT_NIV_FONCT, (\"Contenu non configuré : %s\\n\", tcConf));\n" \
24384  " return (iCodRet);\n" \
24385  " }\n" \
24386  " }\n" \
24387  "\n" \
24388  " pt_debut_element += strlen(tcConf);\n" \
24389  " pt_fin_liste = strchr(pt_debut_element, ',');\n" \
24390  "\n" \
24391  " if (pt_fin_liste == 0)\n" \
24392  " pt_fin_liste = givtcObjCont + strlen(givtcObjCont);\n" \
24393  "\n" \
24394  " memcpy(tcBalise, pt_debut_element, pt_fin_liste - pt_debut_element);\n" \
24395  " tcBalise[pt_fin_liste - pt_debut_element] = '\\0';\n" \
24396  " }\n" \
24397  "\n" \
24398  " pt_debut_element = strstr(givtcObjCont, \"DA/\");\n" \
24399  "\n" \
24400  " if (0 == pt_debut_element)\n" \
24401  " {\n" \
24402  " pt_debut_element = strstr(givtcObjCont, \"da/\");\n" \
24403  "\n" \
24404  " if (0 == pt_debut_element)\n" \
24405  " return (iCodRet);\n" \
24406  " }\n" \
24407  "\n" \
24408  " /* Ecriture dans le fichier de sortie */\n" \
24409  " if ('\\0' != GIVBuffXML[0])\n" \
24410  " {\n" \
24411  " /* Ecriture dans le fichier de sortie */\n" \
24412  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
24413  " }\n" \
24414  "\n" \
24415  " *buf_pos_in = buf_pos;\n" \
24416  " pt_fin_liste = strchr(pt_debut_element, ',');\n" \
24417  "\n" \
24418  " if (pt_fin_liste == 0)\n" \
24419  " pt_fin_liste = givtcObjCont + strlen(givtcObjCont);\n" \
24420  "\n" \
24421  " /* un seul epj entre les doc */\n" \
24422  " i = 0;\n" \
24423  " pt_mil_element = pt_debut_element + 3;\n" \
24424  "\n" \
24425  " while (pt_fin_liste > pt_mil_element)\n" \
24426  " {\n" \
24427  " /* analyse type et balise associés */\n" \
24428  " pt_fin_element = strchr(pt_mil_element, '/');\n" \
24429  "\n" \
24430  " if ((pt_fin_element == 0) || (pt_fin_element > pt_fin_liste))\n" \
24431  " pt_fin_element = pt_fin_liste;\n" \
24432  "\n" \
24433  " memcpy(tcSource, pt_mil_element, pt_fin_element - pt_mil_element);\n" \
24434  " tcSource[pt_fin_element - pt_mil_element] = '\\0';\n" \
24435  " GWTTrace(GWT_NIV_FONCT, (\"source DA %s, %s, %c, %s\\n\", apcType, tcSource, (doc + i)->value.a_classer.parinsee, (doc + i)->value.a_classer.etab));\n" \
24436  "\n" \
24437  " if (('0' == (doc + i)->value.a_classer.parinsee) && (0 == strcmp(tcSource, giv_B2B)))\n" \
24438  " {\n" \
24439  " /* pas parution des données insee pour B2B */\n" \
24440  " pt_mil_element = pt_fin_element + 1;\n" \
24441  " continue;\n" \
24442  " }\n" \
24443  "\n" \
24444  " /* lecture données additionnelles */\n" \
24445  " if (0 == strcmp(tcRef, apcType))\n" \
24446  " {\n" \
24447  " /* données additionnelles en base */\n" \
24448  " iRet = givLectureEtabDonSupp((doc + i)->value.a_classer.etab, \"\", tcSource, giv_ADD);\n" \
24449  " GWTTrace(GWT_NIV_FONCT, (\"source DA %s\\n\", (doc + i)->value.a_classer.etab));\n" \
24450  " }\n" \
24451  " else if (0 == strcmp(tcType, apcType))\n" \
24452  " {\n" \
24453  " /* données additionnelles annotées en fichier */\n" \
24454  " iCodRet = givEcritSgiProED(apcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, \"\", \"\", tcSource, &iDebut);\n" \
24455  " GWTTrace(GWT_NIV_FONCT, (\"source AD %s\\n\", (doc + i)->value.a_classer.etab));\n" \
24456  " }\n" \
24457  " else\n" \
24458  " {\n" \
24459  " /* données additionnelles annotées en base */\n" \
24460  " iCodRet = givEcritDonEtab(apcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, \"\", \"\", tcSource, &iDebut);\n" \
24461  " GWTTrace(GWT_NIV_FONCT, (\"source ad %s\\n\", (doc + i)->value.a_classer.etab));\n" \
24462  " }\n" \
24463  "\n" \
24464  " if ((0 != strlen(GIVBuffInter)) && (0 == strcmp(tcRef, apcType)))\n" \
24465  " {\n" \
24466  " if (1 == iDebut)\n" \
24467  " {\n" \
24468  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"DonneesAddit\");\n" \
24469  " buf_pos = buf_pos + lg_write;\n" \
24470  " iDebut = 0;\n" \
24471  " }\n" \
24472  "\n" \
24473  " strcpy(buf_pos, \"<Addit_\");\n" \
24474  " }\n" \
24475  " else if ((0 != strlen(GIVBuffInter)) && (0 != strcmp(tcType, apcType)))\n" \
24476  " {\n" \
24477  " if (1 == iDebut)\n" \
24478  " {\n" \
24479  " lg_write = giv_ecrit_noeud_simple(buf_pos, tcBalise);\n" \
24480  " buf_pos = buf_pos + lg_write;\n" \
24481  " iDebut = 0;\n" \
24482  " }\n" \
24483  "\n" \
24484  " strcpy(buf_pos, \"<Search_\");\n" \
24485  " }\n" \
24486  "\n" \
24487  " if ((0 != strlen(GIVBuffInter)) && ((0 != strcmp(tcType, apcType)) || (0 == strcmp(tcRef, apcType))))\n" \
24488  " {\n" \
24489  " strcat(buf_pos, tcSource);\n" \
24490  " strcat(buf_pos, \" etablissement=\\\"\\\" id=\\\"\");\n" \
24491  " strcat(buf_pos, (doc + i)->value.a_classer.etab);\n" \
24492  " strcat(buf_pos, \"\\\">\");\n" \
24493  " lg_ecr = strlen(buf_pos);\n" \
24494  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24495  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24496  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24497  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24498  " strcpy(buf_pos, GIVBuffInter);\n" \
24499  " lg_ecr = strlen(buf_pos);\n" \
24500  " buf_pos = (buf_pos + lg_ecr);\n" \
24501  "\n" \
24502  " if (0 == strcmp(tcRef, apcType))\n" \
24503  " strcpy(buf_pos, \"</Addit_\");\n" \
24504  " else\n" \
24505  " strcpy(buf_pos, \"</Search_\");\n" \
24506  "\n" \
24507  " strcat(buf_pos, tcSource);\n" \
24508  " strcat(buf_pos, \">\");\n" \
24509  " lg_ecr = strlen(buf_pos);\n" \
24510  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24511  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24512  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24513  " buf_pos = buf_pos + strlen(buf_pos);\n" \
24514  " }\n" \
24515  "\n" \
24516  " if ('\\0' != GIVBuffXML[0])\n" \
24517  " {\n" \
24518  " /* Ecriture dans le fichier de sortie */\n" \
24519  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
24520  " }\n" \
24521  "\n" \
24522  " /* source suivante */\n" \
24523  " pt_mil_element = pt_fin_element + 1;\n" \
24524  " }\n" \
24525  "\n" \
24526  " if ((0 == iDebut) && (0 == strcmp(tcRef, apcType)))\n" \
24527  " {\n" \
24528  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"DonneesAddit\");\n" \
24529  " buf_pos = buf_pos + lg_write;\n" \
24530  " }\n" \
24531  " else if (0 == iDebut)\n" \
24532  " {\n" \
24533  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBalise);\n" \
24534  " buf_pos = buf_pos + lg_write;\n" \
24535  " }\n" \
24536  "\n" \
24537  " if ('\\0' != GIVBuffXML[0])\n" \
24538  " {\n" \
24539  " /* Ecriture dans le fichier de sortie */\n" \
24540  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
24541  " }\n" \
24542  "\n" \
24543  " *buf_pos_in = buf_pos;\n" \
24544  " GWTTrace(GWT_NIV_FONCT, (\"Sortie Ecriture Données enrichies par établissement\\n\"));\n" \
24545  " return (iCodRet);\n" \
24546  "}\n" \
24547  "\n" \
24548  "/*----Fonction----------------------------------------------------------------*/\n" \
24549  "/* */\n" \
24550  "/* Fonction : givEcritDonHoraires() */\n" \
24551  "/* */\n" \
24552  "/* But : ecrit les données info horaires */\n" \
24553  "/* payantes liées à l'annonceur */\n" \
24554  "/* gratuites liées à l'établissement */\n" \
24555  "/* lecture xmltype via clob */\n" \
24556  "/* */\n" \
24557  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
24558  "/* */\n" \
24559  "/* Sortie(s) : OK ou KO */\n" \
24560  "/* */\n" \
24561  "/* Portable : Transparent */\n" \
24562  "/* */\n" \
24563  "/* Modification () : */\n" \
24564  "/*----------------------------------------------------------------------------*/\n" \
24565  "\n" \
24566  "static int4 givEcritDonHoraires(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice)\n" \
24567  "\n" \
24568  "{\n" \
24569  " int4 lg_ecr_micro = 0;\n" \
24570  " int4 lg_ecr = 0;\n" \
24571  " int4 i, j = 0;\n" \
24572  " int4 k, x, kk = 0;\n" \
24573  " int4 iDebut = 1;\n" \
24574  " int4 iNbRub = 0;\n" \
24575  " int4 iInitRub = -1;\n" \
24576  " int4 iNbDV = 0;\n" \
24577  " int4 iRefDE = -1;\n" \
24578  " int4 lg_write;\n" \
24579  " char* buf_pos;\n" \
24580  " char* pt_debut_element, *pt_mil_element, *pt_debut_liste, *pt_debut_ref;\n" \
24581  " char* pt_fin_element, *pt_fin_obj, *pt_fin_liste, *pt_fin_ref;\n" \
24582  " char tcObj[GYBIamicLgNumobj2];\n" \
24583  " char tcBalise[50 + 1];\n" \
24584  " int4 iCodRet, iRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
24585  " int4 iLg, lg_a_ecrire;\n" \
24586  " int4 iRang, iObj;\n" \
24587  " pt_fin_liste = givtcObjCont + strlen(givtcObjCont);\n" \
24588  " pt_debut_element = strstr(givtcObjCont, \"om/\");\n" \
24589  "\n" \
24590  " if (0 == pt_debut_element)\n" \
24591  " {\n" \
24592  " pt_debut_element = strstr(givtcObjCont, \"OM/\");\n" \
24593  "\n" \
24594  " if (0 == pt_debut_element)\n" \
24595  " return (iCodRet);\n" \
24596  " }\n" \
24597  "\n" \
24598  " /* Pointeur sur debut du buffer */\n" \
24599  " buf_pos = *buf_pos_in;\n" \
24600  "\n" \
24601  " /* Ecriture dans le fichier de sortie */\n" \
24602  " if ('\\0' != GIVBuffXML[0])\n" \
24603  " {\n" \
24604  " /* Ecriture dans le fichier de sortie */\n" \
24605  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
24606  " }\n" \
24607  "\n" \
24608  " pt_fin_element = strchr(pt_debut_element, ',');\n" \
24609  "\n" \
24610  " if (pt_fin_element == 0)\n" \
24611  " pt_fin_element = pt_fin_liste;\n" \
24612  "\n" \
24613  " pt_mil_element = pt_debut_element + 2;\n" \
24614  " /* analyse type et balise associés */\n" \
24615  " memcpy(tcBalise, (pt_mil_element + 1), (pt_fin_element - pt_mil_element - 1));\n" \
24616  " tcBalise[(pt_fin_element - pt_mil_element - 1)] = '\\0';\n" \
24617  " *buf_pos_in = buf_pos;\n" \
24618  " /* lecture des données horaires normalisées */\n" \
24619  " iRang = -1;\n" \
24620  "\n" \
24621  " for (i = 0; i < givrListObj.iNbr; i++)\n" \
24622  " {\n" \
24623  " k = givrListObj.trEltRangListObj[i];\n" \
24624  " kk = givrListObj.trEltListObj[k].iRgLigne;\n" \
24625  " iObj = givrListObj.trEltListObj[k].iRgObj;\n" \
24626  "\n" \
24627  " if (iRang != givrListObj.trEltListObj[k].iRangTri)\n" \
24628  " {\n" \
24629  " iRang = givrListObj.trEltListObj[k].iRangTri;\n" \
24630  "\n" \
24631  " if (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].type, \"X\"))\n" \
24632  " {\n" \
24633  " /* lecture des infos horaires payantes */\n" \
24634  " GWTTrace(GWT_NIV_FONCT, (\" horaire normalisé obj %d,%s\\n\", iObj, (doc + kk)->value.objets_pub.micro[iObj].id));\n" \
24635  "\n" \
24636  " if (0 == strcmp((doc + kk)->value.objets_pub.micro[iObj].stype, \"HO\"))\n" \
24637  " iRet = givLectureEtabDonSupp(\"\", (doc + kk)->value.objets_pub.micro[iObj].id, (doc + kk)->value.objets_pub.micro[iObj].stype, giv_HPN);\n" \
24638  " else if (2 == (doc + kk)->value.objets_pub.micro[iObj].iCVI)\n" \
24639  " iRet = givLectureEtabDonSupp(\"\", (doc + kk)->value.objets_pub.micro[iObj].id, (doc + kk)->value.objets_pub.micro[iObj].stypcvi, giv_HPN);\n" \
24640  " else\n" \
24641  " {\n" \
24642  " /* contenu valide uniquement pour HO et CVI nouveau avec contenus associés */\n" \
24643  " continue;\n" \
24644  " }\n" \
24645  "\n" \
24646  " if (0 != strlen(GIVBuffInter))\n" \
24647  " {\n" \
24648  " if (1 == iDebut)\n" \
24649  " {\n" \
24650  " lg_write = giv_ecrit_noeud_simple(buf_pos, tcBalise);\n" \
24651  " buf_pos = buf_pos + lg_write;\n" \
24652  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"ompars\");\n" \
24653  " buf_pos = buf_pos + lg_write;\n" \
24654  " iDebut = 0;\n" \
24655  " }\n" \
24656  "\n" \
24657  " strcpy(buf_pos, GIVBuffInter);\n" \
24658  " lg_ecr = strlen(GIVBuffInter);\n" \
24659  " buf_pos = (buf_pos + lg_ecr);\n" \
24660  " GWTTrace(GWT_NIV_FONCT, (\" horaire normalisé obj %d,%d,%s\\n\", kk, iObj, (doc + kk)->value.objets_pub.micro[iObj].id));\n" \
24661  " /* Ecriture dans le fichier de sortie */\n" \
24662  " iRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
24663  " }\n" \
24664  " }\n" \
24665  " }\n" \
24666  " }\n" \
24667  "\n" \
24668  " /* lecture des infos horaires gratuites */\n" \
24669  " GWTTrace(GWT_NIV_FONCT, (\" horaire normalisé epj %s\\n\", doc->value.a_classer.etab));\n" \
24670  " iInitRub = -1;\n" \
24671  " iNbRub = 0;\n" \
24672  " iNbDV = 0;\n" \
24673  " iRefDE = -1;\n" \
24674  "\n" \
24675  " for (j = 0; j < giviNbProfEtab; j++)\n" \
24676  " {\n" \
24677  " if ('N' == givrListProfEtab[j].cIndic)\n" \
24678  " {\n" \
24679  " iNbRub++;\n" \
24680  "\n" \
24681  " if (0 == strcmp(\"DV\", givrListProfEtab[j].tcType))\n" \
24682  " {\n" \
24683  " /* DV */\n" \
24684  " iNbDV++;\n" \
24685  " }\n" \
24686  " else\n" \
24687  " {\n" \
24688  " /* DE */\n" \
24689  " iRefDE = j;\n" \
24690  " }\n" \
24691  " }\n" \
24692  " }\n" \
24693  "\n" \
24694  " for (j = 0; j < giviNbProfEtab; j++)\n" \
24695  " {\n" \
24696  " if ('N' == givrListProfEtab[j].cIndic)\n" \
24697  " {\n" \
24698  " if ((-1 == iInitRub) && (1 == iNbRub))\n" \
24699  " {\n" \
24700  " /* seule donnée DHN pour un epj */\n" \
24701  " iInitRub = j;\n" \
24702  " }\n" \
24703  " else if ((-1 == iInitRub) && (2 == iNbRub) && (-1 != iRefDE))\n" \
24704  " {\n" \
24705  " /* première donnée DHN plus récente entre DV et DE pour un epj */\n" \
24706  " iInitRub = j;\n" \
24707  " }\n" \
24708  " else if ((-1 != iInitRub) && (2 == iNbRub) && (-1 != iRefDE))\n" \
24709  " {\n" \
24710  " /* seconde donnée DHN moins récente entre DV et DE pour un epj */\n" \
24711  " continue;\n" \
24712  " }\n" \
24713  " else if (-1 == iRefDE)\n" \
24714  " {\n" \
24715  " /* plusieurs DHN DV sans DE pour un epj : pas de DHS */\n" \
24716  " }\n" \
24717  " else if (iRefDE == j)\n" \
24718  " {\n" \
24719  " /* plusieurs DHN DV avec DE pour un epj */\n" \
24720  " }\n" \
24721  " else\n" \
24722  " {\n" \
24723  " /* plusieurs DHN pour un epj */\n" \
24724  " continue;\n" \
24725  " }\n" \
24726  "\n" \
24727  " GWTTrace(GWT_NIV_FONCT, (\" horaire normalisé epj %s,%s\\n\", givrListProfEtab[j].tcType, givrListProfEtab[j].tcAn8));\n" \
24728  " iRet = givLectureEtabDonSupp(doc->value.a_classer.etab, givrListProfEtab[j].tcAn8, givrListProfEtab[j].tcType, giv_HGN);\n" \
24729  "\n" \
24730  " if (0 != strlen(GIVBuffInter))\n" \
24731  " {\n" \
24732  " if (1 == iDebut)\n" \
24733  " {\n" \
24734  " lg_write = giv_ecrit_noeud_simple(buf_pos, tcBalise);\n" \
24735  " buf_pos = buf_pos + lg_write;\n" \
24736  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"ompars\");\n" \
24737  " buf_pos = buf_pos + lg_write;\n" \
24738  " iDebut = 0;\n" \
24739  " }\n" \
24740  "\n" \
24741  " strcpy(buf_pos, GIVBuffInter);\n" \
24742  " lg_ecr = strlen(GIVBuffInter);\n" \
24743  " buf_pos = (buf_pos + lg_ecr);\n" \
24744  " /* Ecriture dans le fichier de sortie */\n" \
24745  " iRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
24746  " }\n" \
24747  " }\n" \
24748  " }\n" \
24749  "\n" \
24750  " if (0 == iDebut)\n" \
24751  " {\n" \
24752  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"ompars\");\n" \
24753  " buf_pos = buf_pos + lg_write;\n" \
24754  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBalise);\n" \
24755  " buf_pos = buf_pos + lg_write;\n" \
24756  " /* Ecriture dans le fichier de sortie */\n" \
24757  " iRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
24758  " }\n" \
24759  "\n" \
24760  " *buf_pos_in = buf_pos;\n" \
24761  " GWTTrace(GWT_NIV_FONCT, (\"Sortie Ecriture Infos Horaires\\n\"));\n" \
24762  " return (iCodRet);\n" \
24763  "}\n" \
24764  "\n" \
24765  "/** Génere la date de fraicheur des données en cours de génération, à condition\n" \
24766  " * que celles ci concernent la santé.\n" \
24767  " *\n" \
24768  " * Paramètre : le flux de destination\n" \
24769  " * Retour : le nombre de caractères écrits.\n" \
24770  " */\n" \
24771  "static int4 generer_fraicheur_ameli(char* buffer)\n" \
24772  "{\n" \
24773  " int4 ret = 0;\n" \
24774  " static int4 deja_appele = 0;\n" \
24775  " static char date_ameli[20] =\n" \
24776  " { 0 };\n" \
24777  "\n" \
24778  " if (!deja_appele)\n" \
24779  " {\n" \
24780  " ret = GWTLireConf(\"AMELI_DATE_FRAICHEUR_D_E\", date_ameli);\n" \
24781  "\n" \
24782  " if (ret != GIV::GWTok)\n" \
24783  " date_ameli[0] = '\\0';\n" \
24784  "\n" \
24785  " GWTTrace(GWT_NIV_FONCT, (\"date ameli : \\\"%s\\\"\\n\", date_ameli));\n" \
24786  " deja_appele = 1;\n" \
24787  " }\n" \
24788  "\n" \
24789  " if (strstr(GIVBuffInter, \"<prestationsSante>\") != NULL)\n" \
24790  " {\n" \
24791  " /* sprintf renvoie le nombre de caractères écrits */\n" \
24792  " ret = sprintf(buffer, \"<dateFraicheur>%s</dateFraicheur>\", date_ameli);\n" \
24793  " GWTTrace(GWT_NIV_FONCT, (\"%d caractères ecrits : %s\\n\", ret, buffer));\n" \
24794  " buffer[ret] = SEPARE_LIGNE;\n" \
24795  " buffer[ret + 1] = LINE_FEED;\n" \
24796  " buffer[ret + 2] = '\\0';\n" \
24797  " return (ret + 2);\n" \
24798  " }\n" \
24799  " else\n" \
24800  " return (0);\n" \
24801  "}\n" \
24802  "\n" \
24803  "/*----Fonction----------------------------------------------------------------*/\n" \
24804  "/* */\n" \
24805  "/* Fonction : givEcritDonEnr() */\n" \
24806  "/* lecture xmltype via clob */\n" \
24807  "/* */\n" \
24808  "/* But : ecrit les données enrichies liées à l'établissement */\n" \
24809  "/* */\n" \
24810  "/* */\n" \
24811  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
24812  "/* */\n" \
24813  "/* Sortie(s) : OK ou KO */\n" \
24814  "/* */\n" \
24815  "/* Portable : Transparent */\n" \
24816  "/* */\n" \
24817  "/* Modification () : */\n" \
24818  "/*----------------------------------------------------------------------------*/\n" \
24819  "\n" \
24820  "static int4 givEcritDonEnr(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice)\n" \
24821  "\n" \
24822  "{\n" \
24823  " int4 lg_ecr_micro = 0;\n" \
24824  " int4 lg_ecr = 0;\n" \
24825  " int4 i, j = 0;\n" \
24826  " int4 k, x = 0;\n" \
24827  " int4 iDebut = 1;\n" \
24828  " int4 lg_write;\n" \
24829  " char* buf_pos;\n" \
24830  " char* pt_debut_element, *pt_debut_obj, *pt_debut_liste, *pt_debut_ref;\n" \
24831  " char* pt_fin_element, *pt_fin_obj, *pt_fin_liste, *pt_fin_ref;\n" \
24832  " char tcObj[GYBIamicLgNumobj2];\n" \
24833  " int4 iCodRet, iRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
24834  " int4 lg_a_ecrire;\n" \
24835  " int4 ret = 0;\n" \
24836  " /* Pointeur sur debut du buffer */\n" \
24837  " buf_pos = *buf_pos_in;\n" \
24838  "\n" \
24839  " /* Ecriture dans le fichier de sortie */\n" \
24840  " if ('\\0' != GIVBuffXML[0])\n" \
24841  " {\n" \
24842  " /* Ecriture dans le fichier de sortie */\n" \
24843  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
24844  " }\n" \
24845  "\n" \
24846  " *buf_pos_in = buf_pos;\n" \
24847  " i = 0;\n" \
24848  " /* lecture données enrichies */\n" \
24849  " iRet = givLectureEtabDonSupp((doc + i)->value.a_classer.etab, \"\", \"EN\", giv_ENR);\n" \
24850  "\n" \
24851  " if (0 != strlen(GIVBuffInter))\n" \
24852  " {\n" \
24853  " if (1 == iDebut)\n" \
24854  " {\n" \
24855  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"affscppar\");\n" \
24856  " buf_pos = buf_pos + lg_write;\n" \
24857  " iDebut = 0;\n" \
24858  " }\n" \
24859  "\n" \
24860  " strcpy(buf_pos, \"<annonceur etablissement=\\\"\\\" id=\\\"\");\n" \
24861  " strcat(buf_pos, (doc + i)->value.a_classer.etab);\n" \
24862  " strcat(buf_pos, \"\\\">\");\n" \
24863  " lg_ecr = strlen(buf_pos);\n" \
24864  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24865  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24866  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24867  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24868  " /* analyse <prestationsMenuPayant> */\n" \
24869  " pt_debut_liste = NULL;\n" \
24870  " pt_fin_liste = GIVBuffInter;\n" \
24871  " pt_debut_element = NULL;\n" \
24872  " pt_fin_element = NULL;\n" \
24873  " pt_debut_ref = NULL;\n" \
24874  " pt_fin_ref = NULL;\n" \
24875  "\n" \
24876  " while (NULL != pt_fin_liste)\n" \
24877  " {\n" \
24878  " pt_debut_element = strstr(pt_fin_liste, \"<prestationsMenuPayant \");\n" \
24879  " pt_fin_element = strstr(pt_fin_liste, \"</prestationsMenuPayant>\");\n" \
24880  "\n" \
24881  " if (NULL == pt_fin_element || NULL == pt_debut_element)\n" \
24882  " {\n" \
24883  " /* pas d'élément */\n" \
24884  " break;\n" \
24885  " }\n" \
24886  "\n" \
24887  " if (NULL == pt_debut_liste)\n" \
24888  " pt_debut_liste = pt_debut_element;\n" \
24889  "\n" \
24890  " pt_fin_element += strlen(\"</prestationsMenuPayant>\");\n" \
24891  " pt_fin_element++;\n" \
24892  " pt_fin_liste = pt_fin_element;\n" \
24893  " pt_debut_obj = strstr(pt_debut_element, \"numobj=\\\"\");\n" \
24894  "\n" \
24895  " if ((NULL != pt_debut_obj) && (pt_debut_obj < pt_fin_element) && (NULL == pt_debut_ref))\n" \
24896  " {\n" \
24897  " pt_debut_obj += strlen(\"numobj=\\\"\");\n" \
24898  " pt_fin_obj = strchr(pt_debut_obj, '\\\"');\n" \
24899  "\n" \
24900  " if (NULL == pt_fin_obj)\n" \
24901  " {\n" \
24902  " /* pas d'objet */\n" \
24903  " continue;\n" \
24904  " }\n" \
24905  "\n" \
24906  " if (GYBIamicLgNumobj != (pt_fin_obj - pt_debut_obj))\n" \
24907  " {\n" \
24908  " /* pas d'objet */\n" \
24909  " GWTTrace(GWT_NIV_FONCT, (\"pas d'objet lg %d\\n\", (pt_fin_obj - pt_debut_obj)));\n" \
24910  " continue;\n" \
24911  " }\n" \
24912  "\n" \
24913  " memcpy(tcObj, pt_debut_obj, (pt_fin_obj - pt_debut_obj));\n" \
24914  " tcObj[(pt_fin_obj - pt_debut_obj)] = '\\0';\n" \
24915  " GWTTrace(GWT_NIV_FONCT, (\"Obj BOC <%s>\\n\", tcObj));\n" \
24916  "\n" \
24917  " for (j = 0; j < indice; j++)\n" \
24918  " {\n" \
24919  " for (x = 0; x < (doc + j)->value.objets_pub.nb_micro; x++)\n" \
24920  " {\n" \
24921  " if ((0 == strcmp((doc + j)->value.objets_pub.micro[x].stype, \"SC\")) && (0 == strcmp((doc + j)->value.objets_pub.micro[x].sstype, \"PV\")\n" \
24922  " || 0 == strcmp((doc + j)->value.objets_pub.micro[x].sstype, \"PB\")) && (0 == strcmp((doc + j)->value.objets_pub.micro[x].id, tcObj)))\n" \
24923  " {\n" \
24924  " GWTTrace(GWT_NIV_FONCT, (\"objet menu trouvé\\n\"));\n" \
24925  " pt_debut_ref = pt_debut_element;\n" \
24926  " pt_fin_ref = pt_fin_element;\n" \
24927  " break;\n" \
24928  " }\n" \
24929  " }\n" \
24930  "\n" \
24931  " if ((doc + j)->value.objets_pub.nb_micro != x)\n" \
24932  " break;\n" \
24933  " }\n" \
24934  " }\n" \
24935  " }\n" \
24936  "\n" \
24937  " if ((NULL == pt_debut_ref) && (NULL == pt_debut_liste))\n" \
24938  " {\n" \
24939  " if (NULL != strstr(GIVBuffInter, \"<prestationsMenuGratuit>\"))\n" \
24940  " strcpy(buf_pos, \"<prmenu>1</prmenu>\");\n" \
24941  " else\n" \
24942  " strcpy(buf_pos, \"<prmenu>0</prmenu>\");\n" \
24943  "\n" \
24944  " lg_ecr = strlen(buf_pos);\n" \
24945  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24946  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24947  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24948  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24949  " /* BOCG-442 : Ajout d'une date de fraicheur dans les DE */\n" \
24950  " ret = generer_fraicheur_ameli(buf_pos);\n" \
24951  " buf_pos += ret;\n" \
24952  " /* Fin BOCG-442 */\n" \
24953  " strcpy(buf_pos, GIVBuffInter);\n" \
24954  " lg_ecr = strlen(buf_pos);\n" \
24955  " }\n" \
24956  " else\n" \
24957  " {\n" \
24958  " if (NULL != pt_debut_ref)\n" \
24959  " strcpy(buf_pos, \"<prmenu>1</prmenu>\");\n" \
24960  " else if (NULL != strstr(GIVBuffInter, \"<prestationsMenuGratuit>\"))\n" \
24961  " strcpy(buf_pos, \"<prmenu>1</prmenu>\");\n" \
24962  " else\n" \
24963  " strcpy(buf_pos, \"<prmenu>0</prmenu>\");\n" \
24964  "\n" \
24965  " lg_ecr = strlen(buf_pos);\n" \
24966  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24967  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24968  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24969  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
24970  " /* BOCG-442 : Ajout d'une date de fraicheur dans les DE */\n" \
24971  " ret = generer_fraicheur_ameli(buf_pos);\n" \
24972  " buf_pos += ret;\n" \
24973  " /* Fin BOCG-442 */\n" \
24974  " memcpy(buf_pos, GIVBuffInter, (pt_debut_liste - GIVBuffInter));\n" \
24975  " lg_ecr = (pt_debut_liste - GIVBuffInter);\n" \
24976  " buf_pos = (buf_pos + lg_ecr);\n" \
24977  "\n" \
24978  " if (NULL != pt_debut_ref)\n" \
24979  " {\n" \
24980  " memcpy(buf_pos, pt_debut_ref, (pt_fin_ref - pt_debut_ref));\n" \
24981  " lg_ecr = (pt_fin_ref - pt_debut_ref);\n" \
24982  " buf_pos = (buf_pos + lg_ecr);\n" \
24983  " }\n" \
24984  "\n" \
24985  " strcpy(buf_pos, pt_fin_liste);\n" \
24986  " lg_ecr = strlen(pt_fin_liste);\n" \
24987  " }\n" \
24988  "\n" \
24989  " buf_pos = (buf_pos + lg_ecr);\n" \
24990  " strcpy(buf_pos, \"</annonceur>\");\n" \
24991  " lg_ecr = strlen(buf_pos);\n" \
24992  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
24993  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
24994  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
24995  " buf_pos = buf_pos + strlen(buf_pos);\n" \
24996  " }\n" \
24997  "\n" \
24998  " if ('\\0' != GIVBuffXML[0])\n" \
24999  " {\n" \
25000  " /* Ecriture dans le fichier de sortie */\n" \
25001  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
25002  " }\n" \
25003  "\n" \
25004  " if (0 == iDebut)\n" \
25005  " {\n" \
25006  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"affscppar\");\n" \
25007  " buf_pos = buf_pos + lg_write;\n" \
25008  " }\n" \
25009  "\n" \
25010  " if ('\\0' != GIVBuffXML[0])\n" \
25011  " {\n" \
25012  " /* Ecriture dans le fichier de sortie */\n" \
25013  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
25014  " }\n" \
25015  "\n" \
25016  " *buf_pos_in = buf_pos;\n" \
25017  " GWTTrace(GWT_NIV_FONCT, (\"Sortie Ecriture Données enrichies par établissement\\n\"));\n" \
25018  " return (iCodRet);\n" \
25019  "}\n" \
25020  "\n" \
25021  "/*----Fonction----------------------------------------------------------------*/\n" \
25022  "/* */\n" \
25023  "/* Fonction : givEcritDonAnnonceur() */\n" \
25024  "/* */\n" \
25025  "/* But : ecrit les contenus liées à l'annonceur */\n" \
25026  "/* lecture xmltype via clob */\n" \
25027  "/* */\n" \
25028  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
25029  "/* */\n" \
25030  "/* Sortie(s) : OK ou KO */\n" \
25031  "/* */\n" \
25032  "/* Portable : Transparent */\n" \
25033  "/* */\n" \
25034  "/* Modification () : */\n" \
25035  "/*----------------------------------------------------------------------------*/\n" \
25036  "\n" \
25037  "static int4 givEcritDonAnnonceur(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 iDoc, int4 iRef, int4 indice, char* pcBalise, int4 iBalise)\n" \
25038  "\n" \
25039  "{\n" \
25040  " char* buf_pos;\n" \
25041  " int4 iCodRet, iRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
25042  " char* pt_debut_liste, *pt_fin_liste, *pcFin;\n" \
25043  " int4 lg_ecr;\n" \
25044  " int4 i, k, iNbCRC;\n" \
25045  "\n" \
25046  " if (0 == strlen((doc + iDoc)->value.objets_pub.micro[iRef].id))\n" \
25047  " {\n" \
25048  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
25049  " return (iCodRet);\n" \
25050  " }\n" \
25051  "\n" \
25052  " /* Pointeur sur debut du buffer */\n" \
25053  " buf_pos = *buf_pos_in;\n" \
25054  " iCodRet = GIV::GWCCodeKO;\n" \
25055  "\n" \
25056  " /* Ecriture dans le fichier de sortie */\n" \
25057  " if ('\\0' != GIVBuffXML[0])\n" \
25058  " {\n" \
25059  " /* Ecriture dans le fichier de sortie */\n" \
25060  " iRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
25061  " }\n" \
25062  "\n" \
25063  " *buf_pos_in = buf_pos;\n" \
25064  "\n" \
25065  " /* lecture des contenus */\n" \
25066  " if (0 == (doc + iDoc)->value.objets_pub.micro[iRef].iCVI)\n" \
25067  " iRet = givLectureEtabDonSupp(\"\", (doc + iDoc)->value.objets_pub.micro[iRef].id, (doc + iDoc)->value.objets_pub.micro[iRef].stype, giv_ANN);\n" \
25068  " else\n" \
25069  " iRet = givLectureEtabDonSupp(\"\", (doc + iDoc)->value.objets_pub.micro[iRef].id, doc->value.objets_pub.micro[iRef].stypcvi, giv_ANN);\n" \
25070  "\n" \
25071  " iNbCRC = giviNbCRC;\n" \
25072  "\n" \
25073  " if (0 != strlen(GIVBuffInter))\n" \
25074  " {\n" \
25075  " if (buf_pos == *buf_pos_in)\n" \
25076  " {\n" \
25077  " if (((int4)GIV::GIXCodeKO == iBalise) || ((int4)GIV::GIXCodeRIEN == iBalise))\n" \
25078  " {\n" \
25079  " lg_ecr = giv_ecrit_noeud_simple(buf_pos, pcBalise);\n" \
25080  " buf_pos = buf_pos + lg_ecr;\n" \
25081  " }\n" \
25082  "\n" \
25083  " iRet = giv_ecrit_objet_pub(&buf_pos, (doc + iDoc), 0, iRef, \"objetcontenu\");\n" \
25084  " }\n" \
25085  "\n" \
25086  " pt_fin_liste = GIVBuffInter;\n" \
25087  " pt_debut_liste = strstr(pt_fin_liste, \"<sgipro>\");\n" \
25088  " pt_debut_liste += strlen(\"<sgipro>\");\n" \
25089  " pt_debut_liste++;\n" \
25090  " pt_fin_liste = strstr(pt_debut_liste, \"</sgipro>\");\n" \
25091  " *pt_fin_liste = '\\0';\n" \
25092  " iRet = givAnalyseObjetXML((doc + iDoc)->value.objets_pub.micro[iRef].stype, (doc + iDoc), pt_debut_liste, &buf_pos);\n" \
25093  "\n" \
25094  " if ('\\0' != GIVBuffXML[0])\n" \
25095  " {\n" \
25096  " GWTTrace(GWT_NIV_FONCT, (\"EtabDonSupp : %s, %s, %d, %s\\n\", (doc + iDoc)->value.objets_pub.micro[iRef].id, (doc + iDoc)->value.objets_pub.micro[iRef].stype, strlen(GIVBuffInter), GIVBuffInter));\n" \
25097  "\n" \
25098  " if ((0 == strcmp(\"SC\", (doc + iDoc)->value.objets_pub.micro[iRef].stype)) && (0 != strcmp(\"SR\", (doc + iDoc)->value.objets_pub.micro[iRef].sstype)))\n" \
25099  " {\n" \
25100  " (void)strcpy(GIVBuffClob, GIVBuffXML);\n" \
25101  " pcFin = strstr(GIVBuffClob, \"</pvi>\");\n" \
25102  "\n" \
25103  " if (0 != pcFin)\n" \
25104  " {\n" \
25105  " /* pour PVI inclusion du contenu \"IP\" */\n" \
25106  " iRet = givLectureEtabDonSupp(\"\", (doc + iDoc)->value.objets_pub.micro[iRef].id, \"IP\", giv_ANN);\n" \
25107  "\n" \
25108  " if (0 != strlen(GIVBuffInter))\n" \
25109  " {\n" \
25110  " /* copie de la fin de contenu SC */\n" \
25111  " strcat(GIVBuffInter, pcFin);\n" \
25112  " strcpy(pcFin, GIVBuffInter);\n" \
25113  " strcpy(GIVBuffXML, GIVBuffClob);\n" \
25114  " buf_pos = GIVBuffXML;\n" \
25115  " lg_ecr = strlen(GIVBuffXML);\n" \
25116  " buf_pos = (buf_pos + lg_ecr);\n" \
25117  " }\n" \
25118  " else\n" \
25119  " {\n" \
25120  " /* pour PVI inclusion du fichier \"IP\" */\n" \
25121  " pcFin = strstr(GIVBuffXML, \"</pvi>\");\n" \
25122  " strcpy(GIVBuffInter, pcFin);\n" \
25123  " buf_pos = pcFin;\n" \
25124  " iRet = givEcritImages(&buf_pos, (doc + iDoc), iRef);\n" \
25125  " strcpy(buf_pos, GIVBuffInter);\n" \
25126  " lg_ecr = strlen(GIVBuffInter);\n" \
25127  " buf_pos = (buf_pos + lg_ecr);\n" \
25128  " }\n" \
25129  " }\n" \
25130  " }\n" \
25131  "\n" \
25132  " if (buf_pos != *buf_pos_in)\n" \
25133  " iCodRet = GIV::GWCCodeOK;\n" \
25134  "\n" \
25135  " /* Ecriture dans le fichier de sortie */\n" \
25136  " iRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
25137  " }\n" \
25138  " }\n" \
25139  "\n" \
25140  " *buf_pos_in = buf_pos;\n" \
25141  " GWTTrace(GWT_NIV_FONCT, (\"Sortie Ecriture Contenus par annonceur %s, %s, %d, %d\\n\", (doc + iDoc)->value.objets_pub.micro[iRef].id, (doc + iDoc)->value.objets_pub.micro[iRef].stype, iNbCRC,\n" \
25142  " giviNbCRC));\n" \
25143  " return (iCodRet);\n" \
25144  "}\n" \
25145  "\n" \
25146  "/*----Fonction----------------------------------------------------------------*/\n" \
25147  "/* */\n" \
25148  "/* Fonction : givEcritDonEtab() */\n" \
25149  "/* */\n" \
25150  "/* But : ecrit les contenus liées à l'établissement */\n" \
25151  "/* lecture xmltype via clob */\n" \
25152  "/* */\n" \
25153  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
25154  "/* */\n" \
25155  "/* Sortie(s) : OK ou KO */\n" \
25156  "/* */\n" \
25157  "/* Portable : Transparent */\n" \
25158  "/* */\n" \
25159  "/* Modification () : */\n" \
25160  "/*----------------------------------------------------------------------------*/\n" \
25161  "\n" \
25162  "static int4 givEcritDonEtab(char* obj, char* pcBalise, char** buf_pos_in, char* buf_pos_ref, GYBrDOCUMENTEpj* doc, char* tcRub, char* tcDep, char* tcSource, int4* piDeb)\n" \
25163  "\n" \
25164  "{\n" \
25165  " char* buf_pos;\n" \
25166  " int4 iCodRet, iRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
25167  " char* pt_debut_liste, *pt_fin_liste, *pcFin;\n" \
25168  " char* pt_debut_element, *pt_fin_element;\n" \
25169  " char* pcDebSite, *pcFinSite;\n" \
25170  " int4 lg_ecr, iLg;\n" \
25171  " int4 i, j, k, iNbCRC, iDeb;\n" \
25172  " char tcAn9[GYBPaprofLgCodan9 + 1];\n" \
25173  " char cStrRef[100 + 1] = \"\";\n" \
25174  " char cStrFinRef[100 + 1] = \"\";\n" \
25175  " /* Pointeur sur debut du buffer */\n" \
25176  " buf_pos = *buf_pos_in;\n" \
25177  "\n" \
25178  " /* Ecriture dans le fichier de sortie */\n" \
25179  " if ('\\0' != GIVBuffXML[0])\n" \
25180  " {\n" \
25181  " /* Ecriture dans le fichier de sortie */\n" \
25182  " iRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
25183  " }\n" \
25184  "\n" \
25185  " for (i = 0; i < giviNbContEtab; i++)\n" \
25186  " {\n" \
25187  " if (0 == strcmp(doc->value.a_classer.etab, givrListContEtab[i].tcEtab))\n" \
25188  " {\n" \
25189  " if ((0 == strcmp(obj, givrListContEtab[i].tcType)) && (0 == strlen(tcRub)))\n" \
25190  " break;\n" \
25191  " else if ((0 == strcmp(obj, givrListContEtab[i].tcType)) && (0 == strcmp(tcRub, givrListContEtab[i].tcThm)))\n" \
25192  " break;\n" \
25193  " }\n" \
25194  " }\n" \
25195  "\n" \
25196  " if (giviNbContEtab == i)\n" \
25197  " {\n" \
25198  " /* contenu absent pour l'epj */\n" \
25199  " GWTTrace(GWT_NIV_FONCT, (\"Contenu absent pour l'epj : %s, %s\\n\", obj, doc->value.a_classer.etab));\n" \
25200  " GIVBuffInter[0] = '\\0';\n" \
25201  " return (iCodRet);\n" \
25202  " }\n" \
25203  "\n" \
25204  " *buf_pos_in = buf_pos;\n" \
25205  "\n" \
25206  " /* lecture des contenus */\n" \
25207  " if (0 != strcmp(\"AD\", obj))\n" \
25208  " iRet = givLectureEtabDonSupp(doc->value.a_classer.etab, tcRub, obj, giv_EPJ);\n" \
25209  " else\n" \
25210  " iRet = givLectureEtabDonSupp(doc->value.a_classer.etab, tcSource, obj, giv_ANO);\n" \
25211  "\n" \
25212  " iDeb = *piDeb;\n" \
25213  " iNbCRC = giviNbCRC;\n" \
25214  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
25215  "\n" \
25216  " if (0 == strcmp(\"RA\", obj))\n" \
25217  " {\n" \
25218  " strcpy(cStrRef, \"<avis>\");\n" \
25219  " strcpy(cStrFinRef, \"</avis>\");\n" \
25220  " }\n" \
25221  " else\n" \
25222  " {\n" \
25223  " strcpy(cStrRef, \"<sgipro>\");\n" \
25224  " strcpy(cStrFinRef, \"</sgipro>\");\n" \
25225  " }\n" \
25226  "\n" \
25227  " if (0 != strlen(GIVBuffInter))\n" \
25228  " {\n" \
25229  " pcDebSite = strstr(GIVBuffInter, \"<urlSite>\");\n" \
25230  "\n" \
25231  " if ((0 == strcmp(\"EG\", obj)) && (0 != pcDebSite))\n" \
25232  " {\n" \
25233  " pcDebSite += strlen(\"<urlSite>\");\n" \
25234  " pcFinSite = strstr(pcDebSite, \"</urlSite>\");\n" \
25235  "\n" \
25236  " if ((GYBIeinscLgLibUrl2 * 4) > (pcFinSite - pcDebSite))\n" \
25237  " {\n" \
25238  " memcpy(doc->value.objets_pub.libUrlSite, pcDebSite, pcFinSite - pcDebSite);\n" \
25239  " doc->value.objets_pub.libUrlSite[pcFinSite - pcDebSite] = '\\0';\n" \
25240  " }\n" \
25241  " else\n" \
25242  " GWTTrace(GWT_NIV_GRAVE, (\"Taille réservée pour liburlSite insuffisante %d, %s\\n\", (pcFinSite - pcDebSite), doc->value.a_classer.etab));\n" \
25243  " }\n" \
25244  "\n" \
25245  " if ((0 == strcmp(\"EG\", obj)) && (1 == doc->value.a_classer.iBLEPJProf))\n" \
25246  " {\n" \
25247  " pt_debut_liste = NULL;\n" \
25248  " pt_debut_element = NULL;\n" \
25249  " pt_fin_element = NULL;\n" \
25250  " pt_fin_liste = GIVBuffInter;\n" \
25251  "\n" \
25252  " while (NULL != pt_fin_liste)\n" \
25253  " {\n" \
25254  " pt_debut_element = strstr(pt_fin_liste, \"<lstMarques>\");\n" \
25255  "\n" \
25256  " if (NULL == pt_debut_element)\n" \
25257  " {\n" \
25258  " /* fin */\n" \
25259  " pt_fin_liste = pt_debut_element;\n" \
25260  " }\n" \
25261  " else\n" \
25262  " {\n" \
25263  " pt_debut_liste = pt_debut_element;\n" \
25264  " pt_fin_element = strstr(pt_debut_element, \"</lstMarques>\");\n" \
25265  "\n" \
25266  " if (NULL == pt_fin_element)\n" \
25267  " {\n" \
25268  " /* fin */\n" \
25269  " pt_fin_liste = pt_fin_element;\n" \
25270  " }\n" \
25271  " else\n" \
25272  " {\n" \
25273  " pt_fin_liste = pt_fin_element + strlen(\"</lstMarques>\");\n" \
25274  " iLg = strlen(pt_fin_liste) + 1;\n" \
25275  " memmove(pt_debut_liste, pt_fin_liste, iLg);\n" \
25276  " pt_fin_liste = pt_debut_liste;\n" \
25277  " }\n" \
25278  " }\n" \
25279  " }\n" \
25280  " }\n" \
25281  " else if (0 == strcmp(\"RA\", obj))\n" \
25282  " {\n" \
25283  " pt_debut_liste = NULL;\n" \
25284  " pt_debut_element = NULL;\n" \
25285  " pt_fin_element = NULL;\n" \
25286  " pt_fin_liste = GIVBuffInter;\n" \
25287  "\n" \
25288  " while (NULL != pt_fin_liste)\n" \
25289  " {\n" \
25290  " pt_debut_element = strstr(pt_fin_liste, \"<fragment\");\n" \
25291  "\n" \
25292  " if (NULL == pt_debut_element)\n" \
25293  " {\n" \
25294  " /* fin */\n" \
25295  " pt_fin_liste = pt_debut_element;\n" \
25296  " }\n" \
25297  " else\n" \
25298  " {\n" \
25299  " pt_debut_liste = pt_debut_element;\n" \
25300  " pt_fin_element = strstr(pt_debut_element, \"</fragment\");\n" \
25301  "\n" \
25302  " if (NULL == pt_fin_element)\n" \
25303  " {\n" \
25304  " /* fin */\n" \
25305  " pt_fin_liste = pt_fin_element;\n" \
25306  " }\n" \
25307  " else\n" \
25308  " {\n" \
25309  " pt_fin_element++;\n" \
25310  " pt_fin_liste = strchr(pt_fin_element, '<');\n" \
25311  " pt_debut_element = strstr(pt_debut_liste, \"rubrique\");\n" \
25312  "\n" \
25313  " if (NULL != pt_debut_element)\n" \
25314  " {\n" \
25315  " pt_debut_element = strchr(pt_debut_element, '>');\n" \
25316  " pt_fin_element = strchr(pt_debut_element, '<');\n" \
25317  "\n" \
25318  " if (NULL != pt_fin_element && NULL != pt_debut_element)\n" \
25319  " {\n" \
25320  " pt_debut_element++;\n" \
25321  "\n" \
25322  " if (GYBPaprofLgCodan9 == (pt_fin_element - pt_debut_element))\n" \
25323  " {\n" \
25324  " memcpy(tcAn9, pt_debut_element, (pt_fin_element - pt_debut_element));\n" \
25325  " tcAn9[(pt_fin_element - pt_debut_element)] = '\\0';\n" \
25326  " GWTTrace(GWT_NIV_FONCT, (\"Rub BOC <%s>\\n\", tcAn9));\n" \
25327  "\n" \
25328  " for (i = 0; i < (givrListParu.iNbrTot); i++)\n" \
25329  " {\n" \
25330  " j = givrListParu.trEltRangList[i];\n" \
25331  "\n" \
25332  " if (0 == strcmp(givrListParu.trEltList[j].rub, tcRub))\n" \
25333  " break;\n" \
25334  " }\n" \
25335  "\n" \
25336  " if (i != givrListParu.iNbrTot)\n" \
25337  " {\n" \
25338  " /* rubrique commune */\n" \
25339  " continue;\n" \
25340  " }\n" \
25341  " }\n" \
25342  " }\n" \
25343  " }\n" \
25344  "\n" \
25345  " /* pas de rubrique commune : black liste */\n" \
25346  " iLg = strlen(pt_fin_liste) + 1;\n" \
25347  " memmove(pt_debut_liste, pt_fin_liste, iLg);\n" \
25348  " pt_fin_liste = pt_debut_liste;\n" \
25349  " }\n" \
25350  " }\n" \
25351  " }\n" \
25352  " }\n" \
25353  "\n" \
25354  " GWTTrace(GWT_NIV_FONCT, (\"EtabDonSupp : %s, %s, %d, %s\\n\", obj, doc->value.a_classer.etab, strlen(GIVBuffInter), GIVBuffInter));\n" \
25355  "\n" \
25356  " if ((1 == *piDeb) && ((0 == strcmp(\"GS\", obj)) || (0 == strcmp(\"RA\", obj)) || (0 == strcmp(\"AD\", obj)) || (0 == strcmp(\"DC\", obj))))\n" \
25357  " {\n" \
25358  " lg_ecr = giv_ecrit_noeud_simple(buf_pos, pcBalise);\n" \
25359  " buf_pos = buf_pos + lg_ecr;\n" \
25360  " *piDeb = 0;\n" \
25361  " }\n" \
25362  " else if (1 == *piDeb)\n" \
25363  " {\n" \
25364  " lg_ecr = giv_ecrit_noeud_simple(buf_pos, pcBalise);\n" \
25365  " buf_pos = buf_pos + lg_ecr;\n" \
25366  " strcpy(buf_pos, \"<sgipro>\");\n" \
25367  " lg_ecr = strlen(buf_pos);\n" \
25368  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
25369  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
25370  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
25371  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
25372  " *piDeb = 0;\n" \
25373  " }\n" \
25374  "\n" \
25375  " pt_fin_liste = GIVBuffInter;\n" \
25376  " pt_debut_liste = strstr(pt_fin_liste, cStrRef);\n" \
25377  "\n" \
25378  " if (NULL != pt_debut_liste)\n" \
25379  " {\n" \
25380  " pt_debut_liste += strlen(cStrRef);\n" \
25381  " pt_debut_liste++;\n" \
25382  " pt_fin_liste = strstr(pt_debut_liste, cStrFinRef);\n" \
25383  " *pt_fin_liste = '\\0';\n" \
25384  " }\n" \
25385  " else\n" \
25386  " pt_debut_liste = GIVBuffInter;\n" \
25387  "\n" \
25388  " iRet = givAnalyseObjetXML(obj, doc, pt_debut_liste, &buf_pos);\n" \
25389  "\n" \
25390  " if ((int4)GIV::GIXCodeKO == iRet)\n" \
25391  " {\n" \
25392  " /* fichier global non inclus : retour à état à l'appel */\n" \
25393  " buf_pos = *buf_pos_in;\n" \
25394  " *piDeb = iDeb;\n" \
25395  " *buf_pos = '\\0';\n" \
25396  " giviNbCRC = iNbCRC;\n" \
25397  " givrListCRC.iNbr = giviNbCRC;\n" \
25398  " }\n" \
25399  "\n" \
25400  " if ((0 == strcmp(\"RA\", obj)) || (0 == strcmp(\"DC\", obj)))\n" \
25401  " lg_ecr = giv_ecrit_fin_noeud(&buf_pos, pcBalise);\n" \
25402  "\n" \
25403  " /* Ecriture dans le fichier de sortie */\n" \
25404  " iRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
25405  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
25406  " }\n" \
25407  "\n" \
25408  " *buf_pos_in = buf_pos;\n" \
25409  " GWTTrace(GWT_NIV_FONCT, (\"Sortie Ecriture Contenus par établissement %s, %s, %s, %d, %d\\n\", doc->value.a_classer.etab, tcRub, obj, iNbCRC, giviNbCRC));\n" \
25410  " return (iCodRet);\n" \
25411  "}\n" \
25412  "\n" \
25413  "/*----Fonction----------------------------------------------------------------*/\n" \
25414  "/* */\n" \
25415  "/* Fonction : givEcritDonRelais() */\n" \
25416  "/* */\n" \
25417  "/* But : ecrit les données relais liées à l'établissement */\n" \
25418  "/* lecture xmltype via clob */\n" \
25419  "/* */\n" \
25420  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
25421  "/* */\n" \
25422  "/* Sortie(s) : OK ou KO */\n" \
25423  "/* */\n" \
25424  "/* Portable : Transparent */\n" \
25425  "/* */\n" \
25426  "/* Modification () : */\n" \
25427  "/*----------------------------------------------------------------------------*/\n" \
25428  "\n" \
25429  "static int4 givEcritDonRelais(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 aindice, int4 aindmax)\n" \
25430  "\n" \
25431  "{\n" \
25432  " int4 lg_ecr_micro = 0;\n" \
25433  " int4 lg_ecr = 0;\n" \
25434  " int4 i = 0;\n" \
25435  " int4 lg_write;\n" \
25436  " char* buf_pos;\n" \
25437  " char* pt_debut_element, *pt_debut_obj, *pt_debut_liste, *pt_debut_ref;\n" \
25438  " char* pt_fin_element, *pt_fin_obj, *pt_fin_liste, *pt_fin_ref;\n" \
25439  " char tcObj[GYBIamicLgNumobj2];\n" \
25440  " int4 iCodRet, iRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
25441  " int4 lg_a_ecrire;\n" \
25442  "\n" \
25443  " if (0 == strlen(doc->value.a_classer.etab))\n" \
25444  " return (iCodRet);\n" \
25445  "\n" \
25446  " /* Pointeur sur debut du buffer */\n" \
25447  " buf_pos = *buf_pos_in;\n" \
25448  "\n" \
25449  " /* Ecriture dans le fichier de sortie */\n" \
25450  " if ('\\0' != GIVBuffXML[0])\n" \
25451  " {\n" \
25452  " /* Ecriture dans le fichier de sortie */\n" \
25453  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
25454  " }\n" \
25455  "\n" \
25456  " *buf_pos_in = buf_pos;\n" \
25457  " /* lecture données relais */\n" \
25458  " iRet = givLectureEtabDonSupp(doc->value.a_classer.etab, \"\", \"RL\", giv_REL);\n" \
25459  "\n" \
25460  " if ((0 != strlen(GIVBuffInter)) && (NULL == strstr(GIVBuffInter, \"<lstde/>\")))\n" \
25461  " {\n" \
25462  " strcpy(buf_pos, GIVBuffInter);\n" \
25463  " lg_ecr = strlen(buf_pos);\n" \
25464  " buf_pos = (buf_pos + lg_ecr);\n" \
25465  " }\n" \
25466  "\n" \
25467  " if ('\\0' != GIVBuffXML[0])\n" \
25468  " {\n" \
25469  " /* Ecriture dans le fichier de sortie */\n" \
25470  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
25471  " }\n" \
25472  "\n" \
25473  " *buf_pos_in = buf_pos;\n" \
25474  " GWTTrace(GWT_NIV_FONCT, (\"Sortie Ecriture Données Relais par établissement\\n\"));\n" \
25475  " return (iCodRet);\n" \
25476  "}\n" \
25477  "\n" \
25478  "/*----------------------------------Fonction----------------------------------*\n" \
25479  " * Fonction : givProfURLGratuite\n" \
25480  " *\n" \
25481  " * But : numcli\n" \
25482  " *\n" \
25483  " * Description : Lecture de rubrique de suppression de CRC\n" \
25484  " * dans le fichier GS lié à l'URL Gratuite\n" \
25485  " * dans la table GYTTabURLGrProf.\n" \
25486  " *\n" \
25487  " *\n" \
25488  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
25489  "\n" \
25490  "int4 givLectureProfURLGratuite(char* apcCodAn8)\n" \
25491  "{\n" \
25492  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
25493  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
25494  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
25495  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
25496  " EXEC SQL\n" \
25497  " begin declare\n" \
25498  " section;\n" \
25499  " GYBrIaprofT rIaprof;\n" \
25500  " EXEC SQL\n" \
25501  " end declare\n" \
25502  " section;\n" \
25503  " int4 i;\n" \
25504  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
25505  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
25506  "\n" \
25507  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
25508  " return (iCodRet);\n" \
25509  "\n" \
25510  " (void)strcpy(rIaprof.acCodan8, apcCodAn8);\n" \
25511  " /* Traitement des erreurs SQL */\n" \
25512  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLectureProfURLGr\");\n" \
25513  " EXEC SQL\n" \
25514  " OPEN crsLectureProfURLGr\n" \
25515  " USING: rIaprof.acCodan8;\n" \
25516  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
25517  "\n" \
25518  " if ((int4)GIV::GYBok != iIntRet)\n" \
25519  " {\n" \
25520  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLectureProfURLGr %s: [COD=%d TXT=%s]\\n\", rIaprof.acCodan8, iIntRet, vErreurSQL.acDonnees_retour));\n" \
25521  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
25522  " }\n" \
25523  "\n" \
25524  " if ((int4)GIV::GYBok == iIntRet)\n" \
25525  " {\n" \
25526  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
25527  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLectureProfURLGr\");\n" \
25528  " GWTTrace(GWT_NIV_FONCT, (\" ProfURLGr... %s\\n\", rIaprof.acCodan8));\n" \
25529  "\n" \
25530  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
25531  " {\n" \
25532  " EXEC SQL\n" \
25533  " FETCH crsLectureProfURLGr\n" \
25534  " INTO: rIaprof.acCodan8;\n" \
25535  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
25536  "\n" \
25537  " if ((int4)GIV::GYBok != iIntRet)\n" \
25538  " {\n" \
25539  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
25540  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
25541  " }\n" \
25542  " else\n" \
25543  " {\n" \
25544  " /* sortie sur opposition trouvée */\n" \
25545  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
25546  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
25547  " }\n" \
25548  " }\n" \
25549  " }\n" \
25550  "\n" \
25551  " EXEC SQL\n" \
25552  " close crsLectureProfURLGr;\n" \
25553  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
25554  "\n" \
25555  " if ((int4)GIV::GYBok != iIntRet)\n" \
25556  " {\n" \
25557  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLectureProfURLGr: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
25558  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
25559  " }\n" \
25560  "\n" \
25561  " return (iCodRet);\n" \
25562  "}\n" \
25563  "\n" \
25564  "/*----------------------------------Fonction----------------------------------*\n" \
25565  " * Fonction : givPrioProfCRC\n" \
25566  " *\n" \
25567  " * But : numcli\n" \
25568  " *\n" \
25569  " * Description : Lecture de priorité de CRC\n" \
25570  " * du le fichier contenu\n" \
25571  " * dans la table GYTTabCRCPrioProf.\n" \
25572  " *\n" \
25573  " *\n" \
25574  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
25575  "\n" \
25576  "int4 givLecturePrioProfCRC(char* apcCodAn8, char* apcCRC)\n" \
25577  "{\n" \
25578  " int4 iCodRet = 0; /* Code retour de la fonction */\n" \
25579  " int4 iIntRet = 0; /* Code retour des appels internes */\n" \
25580  " int1 indFinFetch;/* Indicateur de fin de balayage du curseur */\n" \
25581  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
25582  " EXEC SQL\n" \
25583  " begin declare\n" \
25584  " section;\n" \
25585  " GYBrPrioCRCT rPrioCRC;\n" \
25586  " EXEC SQL\n" \
25587  " end declare\n" \
25588  " section;\n" \
25589  " int4 i;\n" \
25590  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
25591  " iIntRet = (int4)GIV::GIXCodeOK;\n" \
25592  "\n" \
25593  " if (0 == strcmp(GXWDepartMultiNat, GIXcDepartement))\n" \
25594  " return (iCodRet);\n" \
25595  "\n" \
25596  " (void)strcpy(rPrioCRC.acCodan8, apcCodAn8);\n" \
25597  " (void)strcpy(rPrioCRC.acCRC, apcCRC);\n" \
25598  " /* Traitement des erreurs SQL */\n" \
25599  " (void)strcpy(vErreurSQL.acOrdre_sql, \"open crsLecturePrioProfCRC\");\n" \
25600  " EXEC SQL\n" \
25601  " OPEN crsLecturePrioProfCRC\n" \
25602  " USING :rPrioCRC.acCodan8,\n" \
25603  " :rPrioCRC.acCRC;\n" \
25604  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
25605  "\n" \
25606  " if ((int4)GIV::GYBok != iIntRet)\n" \
25607  " {\n" \
25608  " GWTTrace(GWT_NIV_FONCT, (\"Erreur open crsLecturePrioProfCRC %s,%s: [COD=%d TXT=%s]\\n\", rPrioCRC.acCodan8, rPrioCRC.acCRC, iIntRet, vErreurSQL.acDonnees_retour));\n" \
25609  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
25610  " }\n" \
25611  "\n" \
25612  " if ((int4)GIV::GYBok == iIntRet)\n" \
25613  " {\n" \
25614  " indFinFetch = (int1)GIV::GIXCodeOK;\n" \
25615  " (void)strcpy(vErreurSQL.acOrdre_sql, \"fetch crsLecturePrioProfCRC\");\n" \
25616  " GWTTrace(GWT_NIV_FONCT, (\" PrioProfCRC... %s,%s\\n\", rPrioCRC.acCodan8, rPrioCRC.acCRC));\n" \
25617  "\n" \
25618  " while ((int1)GIV::GIXCodeOK == indFinFetch)\n" \
25619  " {\n" \
25620  " EXEC SQL\n" \
25621  " FETCH crsLecturePrioProfCRC\n" \
25622  " INTO: rPrioCRC.acCodan8;\n" \
25623  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
25624  "\n" \
25625  " if ((int4)GIV::GYBok != iIntRet)\n" \
25626  " {\n" \
25627  " indFinFetch = (int1)GIV::GIXCodeKO;\n" \
25628  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
25629  " }\n" \
25630  " else\n" \
25631  " {\n" \
25632  " /* sortie sur opposition trouvée */\n" \
25633  " indFinFetch = (int4)GIV::GIXCodeKO;\n" \
25634  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
25635  " }\n" \
25636  " }\n" \
25637  " }\n" \
25638  "\n" \
25639  " EXEC SQL\n" \
25640  " close crsLecturePrioProfCRC;\n" \
25641  " iIntRet = GIVBlocErreur(&vErreurSQL);\n" \
25642  "\n" \
25643  " if ((int4)GIV::GYBok != iIntRet)\n" \
25644  " {\n" \
25645  " GWTTrace(GWT_NIV_FONCT, (\"Erreur close crsLecturePrioProfCRC: [COD=%d TXT=%s]\\n\", iIntRet, vErreurSQL.acDonnees_retour));\n" \
25646  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
25647  " }\n" \
25648  "\n" \
25649  " return (iCodRet);\n" \
25650  "}\n" \
25651  "\n" \
25652  "/*----Fonction----------------------------------------------------------------*/\n" \
25653  "/* */\n" \
25654  "/* Fonction : givAnalyseContenu() */\n" \
25655  "/* */\n" \
25656  "/* But : conflits dans les contenus SGIPRO */\n" \
25657  "/* */\n" \
25658  "/* */\n" \
25659  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
25660  "/* */\n" \
25661  "/* Sortie(s) : OK ou KO */\n" \
25662  "/* */\n" \
25663  "/* Portable : Transparent */\n" \
25664  "/* */\n" \
25665  "/* Modification (Jui/20/2006 - mb) : création de plusieurs fichiers de sortie */\n" \
25666  "/*----------------------------------------------------------------------------*/\n" \
25667  "\n" \
25668  "static int4 givAnalyseContenu(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice)\n" \
25669  "\n" \
25670  "{\n" \
25671  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
25672  " int4 iRet, i, iCVI;\n" \
25673  " char* pt_fin_liste;\n" \
25674  " char* pt_debut_element;\n" \
25675  " char* pt_fin_element;\n" \
25676  " char* pt_mil_element;\n" \
25677  " char* pt_suite_element;\n" \
25678  " char* pt_fin_lst;\n" \
25679  " char* pt_debut;\n" \
25680  " char* pt_fin;\n" \
25681  " char* pt_debut_CVI;\n" \
25682  " char tcType[3 + 1];\n" \
25683  " char tcTYPE[3 + 1];\n" \
25684  " int4 lg_write;\n" \
25685  " int4 iNbCVI;\n" \
25686  " /* Analyse des contenus prioritaires */\n" \
25687  " pt_fin_liste = givtcPrioCont + strlen(givtcPrioCont);\n" \
25688  " /* table des contenus prioritaires vide */\n" \
25689  " giviConflitCRC = GIV::GWCCodeOK;\n" \
25690  " /* pas d'analyse des cvi */\n" \
25691  " iCVI = GIV::GIXCodeKO;\n" \
25692  " iNbCVI = givNbCVI;\n" \
25693  "\n" \
25694  " for (pt_debut_element = givtcPrioCont; pt_debut_element < pt_fin_liste;)\n" \
25695  " {\n" \
25696  " pt_fin_element = strchr(pt_debut_element, ',');\n" \
25697  "\n" \
25698  " if (pt_fin_element == 0)\n" \
25699  " pt_fin_element = pt_fin_liste;\n" \
25700  "\n" \
25701  " pt_mil_element = strchr(pt_debut_element, '/');\n" \
25702  "\n" \
25703  " if (pt_mil_element == 0)\n" \
25704  " pt_mil_element = pt_fin_element;\n" \
25705  "\n" \
25706  " /* analyse type et balise associés */\n" \
25707  " memcpy(tcType, pt_debut_element, (pt_mil_element - pt_debut_element));\n" \
25708  " tcType[(pt_mil_element - pt_debut_element)] = '\\0';\n" \
25709  " strcpy(tcTYPE, tcType);\n" \
25710  " tcTYPE[0] = toupper(tcTYPE[0]);\n" \
25711  " tcTYPE[1] = toupper(tcTYPE[1]);\n" \
25712  " GWTTrace(GWT_NIV_FONCT, (\"Contenu prioritaire : %s\\n\", tcType));\n" \
25713  "\n" \
25714  " if ((0 == strcmp(tcTYPE, \"DC\")) || (0 == strcmp(tcTYPE, \"RA\")) || (0 == strcmp(tcTYPE, \"PR\")) || (0 == strcmp(tcTYPE, \"OM\")) || (0 == strcmp(tcTYPE, \"DA\")))\n" \
25715  " {\n" \
25716  " pt_debut_element = pt_fin_element + 1;\n" \
25717  " continue;\n" \
25718  " }\n" \
25719  "\n" \
25720  " if ((0 == strcmp(\"EG\", tcTYPE)) || (0 == strcmp(\"EM\", tcTYPE)) || (0 == strcmp(\"GS\", tcTYPE)) || (0 == strcmp(\"ED\", tcTYPE)) || (0 == strcmp(\"EE\", tcTYPE)) || (0 == strcmp(\"BB\", tcTYPE))\n" \
25721  " || (0 == strcmp(\"AD\", tcTYPE)) || (0 == strcmp(\"DV\", tcTYPE)) || (0 == strcmp(\"MV\", tcTYPE)))\n" \
25722  " iCodRet = givEcritContenuEDEtab(tcType, buf_pos_in, doc, indice);\n" \
25723  " else\n" \
25724  " {\n" \
25725  " for (i = 0; (i < iNbCVI && 0 != strcmp(givTabCVI[i], tcTYPE)); i++)\n" \
25726  " ;\n" \
25727  "\n" \
25728  " if ((iNbCVI != i) && (GIV::GIXCodeKO == iCVI))\n" \
25729  " {\n" \
25730  " /* premier CVI prioritaire : nouveau CVI */\n" \
25731  " pt_debut_CVI = pt_debut_element;\n" \
25732  " iCVI = GIV::GIXCodeOK;\n" \
25733  " GWTTrace(GWT_NIV_FONCT, (\"CVI Prio 1 : %d,%s\\n\", iCVI, tcType));\n" \
25734  " iCodRet = givEcritContenu(tcType, buf_pos_in, doc, indice, &iCVI);\n" \
25735  " }\n" \
25736  " else if ((iNbCVI == i) && (GIV::GIXCodeKO != iCVI))\n" \
25737  " {\n" \
25738  " /* premier CVI prioritaire : vintage/ancien CVI */\n" \
25739  " GWTTrace(GWT_NIV_FONCT, (\"CVI Prio 2 : %d,%s\\n\", iCVI, tcType));\n" \
25740  "\n" \
25741  " if (GIV::GIXCodeOK != iCVI)\n" \
25742  " {\n" \
25743  " /* dernier CVI prioritaire : nouveau CVI */\n" \
25744  " lg_write = giv_ecrit_fin_noeud(buf_pos_in, \"affcviv\");\n" \
25745  " *buf_pos_in = *buf_pos_in + lg_write;\n" \
25746  " }\n" \
25747  "\n" \
25748  " pt_debut_element = pt_debut_CVI;\n" \
25749  " iNbCVI = 0;\n" \
25750  " iCVI = GIV::GIXCodeKO;\n" \
25751  " continue;\n" \
25752  " }\n" \
25753  " else\n" \
25754  " {\n" \
25755  " GWTTrace(GWT_NIV_FONCT, (\"CVI Prio 3 : %d,%s\\n\", iCVI, tcType));\n" \
25756  " iCodRet = givEcritContenu(tcType, buf_pos_in, doc, indice, &iCVI);\n" \
25757  " }\n" \
25758  " }\n" \
25759  "\n" \
25760  " pt_debut_element = pt_fin_element + 1;\n" \
25761  " }\n" \
25762  "\n" \
25763  " /* Analyse des autres contenus non prioritaires */\n" \
25764  " pt_fin_liste = givtcObjCont + strlen(givtcObjCont);\n" \
25765  " /* table des contenus prioritaires inutilisée */\n" \
25766  " giviConflitCRC = GIV::GWCCodeKO;\n" \
25767  "\n" \
25768  " for (pt_debut_element = givtcObjCont; pt_debut_element < pt_fin_liste;)\n" \
25769  " {\n" \
25770  " pt_fin_element = strchr(pt_debut_element, ',');\n" \
25771  "\n" \
25772  " if (pt_fin_element == 0)\n" \
25773  " pt_fin_element = pt_fin_liste;\n" \
25774  "\n" \
25775  " pt_mil_element = strchr(pt_debut_element, '/');\n" \
25776  "\n" \
25777  " if (pt_mil_element == 0)\n" \
25778  " break;\n" \
25779  "\n" \
25780  " /* analyse premier type et balise associés */\n" \
25781  " pt_suite_element = strchr(pt_debut_element, '|');\n" \
25782  "\n" \
25783  " if ((pt_suite_element != 0) && (pt_suite_element < pt_mil_element))\n" \
25784  " {\n" \
25785  " memcpy(tcType, pt_debut_element, (pt_suite_element - pt_debut_element));\n" \
25786  " tcType[(pt_suite_element - pt_debut_element)] = '\\0';\n" \
25787  " }\n" \
25788  " else\n" \
25789  " {\n" \
25790  " memcpy(tcType, pt_debut_element, (pt_mil_element - pt_debut_element));\n" \
25791  " tcType[(pt_mil_element - pt_debut_element)] = '\\0';\n" \
25792  " }\n" \
25793  "\n" \
25794  " strcpy(tcTYPE, tcType);\n" \
25795  " tcTYPE[0] = toupper(tcTYPE[0]);\n" \
25796  " tcTYPE[1] = toupper(tcTYPE[1]);\n" \
25797  "\n" \
25798  " if (0 != strstr(givtcPrioCont, tcType))\n" \
25799  " {\n" \
25800  " /* contenu prioritaire déjà traité */\n" \
25801  " pt_debut_element = pt_fin_element + 1;\n" \
25802  " continue;\n" \
25803  " }\n" \
25804  "\n" \
25805  " GWTTrace(GWT_NIV_FONCT, (\"Contenu non prioritaire : %s\\n\", tcType));\n" \
25806  "\n" \
25807  " if ((0 == strcmp(tcTYPE, \"DC\")) || (0 == strcmp(tcTYPE, \"RA\")) || (0 == strcmp(tcTYPE, \"PR\")) || (0 == strcmp(tcTYPE, \"OM\")) || (0 == strcmp(tcTYPE, \"DA\")))\n" \
25808  " {\n" \
25809  " pt_debut_element = pt_fin_element + 1;\n" \
25810  " continue;\n" \
25811  " }\n" \
25812  "\n" \
25813  " if ((0 == strcmp(\"EG\", tcTYPE)) || (0 == strcmp(\"EM\", tcTYPE)) || (0 == strcmp(\"GS\", tcTYPE)) || (0 == strcmp(\"ED\", tcTYPE)) || (0 == strcmp(\"EE\", tcTYPE)) || (0 == strcmp(\"BB\", tcTYPE))\n" \
25814  " || (0 == strcmp(\"AD\", tcTYPE)) || (0 == strcmp(\"DV\", tcTYPE)) || (0 == strcmp(\"MV\", tcTYPE)))\n" \
25815  " iCodRet = givEcritContenuEDEtab(tcType, buf_pos_in, doc, indice);\n" \
25816  " else\n" \
25817  " {\n" \
25818  " iCVI = GIV::GIXCodeKO;\n" \
25819  " iCodRet = givEcritContenu(tcType, buf_pos_in, doc, indice, &iCVI);\n" \
25820  " }\n" \
25821  "\n" \
25822  " pt_debut_element = pt_fin_element + 1;\n" \
25823  " }\n" \
25824  "\n" \
25825  " return (iCodRet);\n" \
25826  "}\n" \
25827  "\n" \
25828  "/*----Fonction----------------------------------------------------------------*/\n" \
25829  "/* */\n" \
25830  "/* Fonction : givAnalyseObjetXML() */\n" \
25831  "/* */\n" \
25832  "/* But : analyse des objets dans un fichier SGIPRO */\n" \
25833  "/* modification au format mongoDB */\n" \
25834  "/* Entree(s) : chaîne */\n" \
25835  "/* */\n" \
25836  "/* Sortie(s) : OK ou KO */\n" \
25837  "/* */\n" \
25838  "/* Portable : Transparent */\n" \
25839  "/* */\n" \
25840  "/* Modification : */\n" \
25841  "/*----------------------------------------------------------------------------*/\n" \
25842  "\n" \
25843  "static int4 givAnalyseObjetXML(char* apcType, GYBrDOCUMENTEpj* doc, char* apcChaine, char** buf_pos_in)\n" \
25844  "{\n" \
25845  " char cStr1[4098 + 1] = \"\";\n" \
25846  " char tcBalise[50 + 1];\n" \
25847  " char tcBaliseFin[50 + 1];\n" \
25848  " char* pt_debut_element, *pt_debut_liste;\n" \
25849  " char* pt_fin_element, *pt_fin_liste;\n" \
25850  " char* pt_debut_prtann, *pt_fin_prtann;\n" \
25851  " char* buf_pos;\n" \
25852  " int4 lg_ecr = 0;\n" \
25853  " int4 iRet, iCodRet = (int4)GIV::GIXCodeOK;\n" \
25854  " pt_debut_liste = NULL;\n" \
25855  " pt_debut_element = NULL;\n" \
25856  " pt_fin_element = NULL;\n" \
25857  " pt_fin_liste = apcChaine;\n" \
25858  " buf_pos = *buf_pos_in;\n" \
25859  " pt_debut_prtann = strstr(pt_fin_liste, \"<donneesprt_annotees\");\n" \
25860  " pt_fin_prtann = strstr(pt_fin_liste, \"</donneesprt_annotees>\");\n" \
25861  "\n" \
25862  " while (NULL != pt_fin_liste)\n" \
25863  " {\n" \
25864  " pt_debut_element = strchr(pt_fin_liste, '<');\n" \
25865  "\n" \
25866  " if (NULL == pt_debut_element)\n" \
25867  " {\n" \
25868  " strcpy(buf_pos, pt_fin_liste);\n" \
25869  " lg_ecr = strlen(buf_pos);\n" \
25870  " /* fin */\n" \
25871  " pt_fin_liste = pt_debut_element;\n" \
25872  " buf_pos = (buf_pos + lg_ecr);\n" \
25873  " }\n" \
25874  " else if (0 == memcmp(pt_debut_element, \"<normale\", strlen(\"<normale\")))\n" \
25875  " {\n" \
25876  " pt_debut_liste = strchr(pt_debut_element, '>');\n" \
25877  " pt_debut_liste++;\n" \
25878  " memcpy(buf_pos, pt_fin_liste, (pt_debut_element - pt_fin_liste));\n" \
25879  " lg_ecr = (pt_debut_element - pt_fin_liste);\n" \
25880  " buf_pos = (buf_pos + lg_ecr);\n" \
25881  " *buf_pos = '\\0';\n" \
25882  " pt_fin_element = strstr(pt_debut_liste, \"</normale>\");\n" \
25883  " pt_fin_element += strlen(\"</normale>\");\n" \
25884  " pt_fin_liste = pt_fin_element;\n" \
25885  " memcpy(cStr1, pt_debut_element, (pt_fin_element - pt_debut_element));\n" \
25886  " cStr1[pt_fin_element - pt_debut_element] = '\\0';\n" \
25887  " /* analyse CRC */\n" \
25888  " iRet = givAnalyseCRC(apcType, -1, doc, cStr1, tcBalise, tcBaliseFin);\n" \
25889  "\n" \
25890  " if ((int4)GIV::GIXCodeOK == iRet)\n" \
25891  " {\n" \
25892  " /* ne pas inclure le contenu */\n" \
25893  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
25894  " }\n" \
25895  "\n" \
25896  " strcpy(buf_pos, cStr1);\n" \
25897  " buf_pos = buf_pos + strlen(cStr1);\n" \
25898  " }\n" \
25899  " else if ((0 == memcmp(pt_debut_element, \"<text>\", strlen(\"<text>\"))) && (0 == strcmp(\"OUI\", givtcContText)) && (0 != strcmp(apcType, \"PR\") || (0 == strcmp(apcType, \"PR\") && NULL != pt_debut_prtann\n" \
25900  " && pt_debut_prtann < pt_debut_element && pt_fin_prtann > pt_debut_element)))\n" \
25901  " {\n" \
25902  " pt_debut_liste = strchr(pt_debut_element, '>');\n" \
25903  " pt_debut_liste++;\n" \
25904  " memcpy(buf_pos, pt_fin_liste, (pt_debut_liste - pt_fin_liste));\n" \
25905  " lg_ecr = (pt_debut_liste - pt_fin_liste);\n" \
25906  " pt_fin_element = strstr(pt_debut_liste, \"</text>\");\n" \
25907  " buf_pos = (buf_pos + lg_ecr);\n" \
25908  " *buf_pos = SEPARE_LIGNE;\n" \
25909  " *(buf_pos + 1) = LINE_FEED;\n" \
25910  " *(buf_pos + 2) = '\\0';\n" \
25911  " buf_pos = (buf_pos + 2);\n" \
25912  " strcpy(buf_pos, \"<contenu>\");\n" \
25913  " buf_pos = buf_pos + strlen(\"<contenu>\");\n" \
25914  " memcpy(buf_pos, pt_debut_liste, (pt_fin_element - pt_debut_liste));\n" \
25915  " lg_ecr = (pt_fin_element - pt_debut_liste);\n" \
25916  " buf_pos = (buf_pos + lg_ecr);\n" \
25917  " strcpy(buf_pos, \"</contenu>\");\n" \
25918  " lg_ecr = strlen(\"</contenu>\");\n" \
25919  " buf_pos = (buf_pos + lg_ecr);\n" \
25920  " *buf_pos = SEPARE_LIGNE;\n" \
25921  " *(buf_pos + 1) = LINE_FEED;\n" \
25922  " *(buf_pos + 2) = '\\0';\n" \
25923  " buf_pos = (buf_pos + 2);\n" \
25924  " *buf_pos = '\\0';\n" \
25925  " pt_fin_liste = pt_fin_element;\n" \
25926  " }\n" \
25927  " else if ((0 == memcmp(pt_debut_element, \"<surface>\", strlen(\"<surface>\"))) && (0 != strcmp(\"MO\", apcType)))\n" \
25928  " {\n" \
25929  " pt_debut_liste = strchr(pt_debut_element, '>');\n" \
25930  " pt_debut_liste++;\n" \
25931  " memcpy(buf_pos, pt_fin_liste, (pt_debut_element - pt_fin_liste));\n" \
25932  " lg_ecr = (pt_debut_element - pt_fin_liste);\n" \
25933  " buf_pos = (buf_pos + lg_ecr);\n" \
25934  " *buf_pos = '\\0';\n" \
25935  " /* remplacement par text */\n" \
25936  " strcpy(buf_pos, \"<text>\");\n" \
25937  " buf_pos = buf_pos + strlen(\"<text>\");\n" \
25938  " pt_fin_element = strstr(pt_debut_liste, \"</surface>\");\n" \
25939  "\n" \
25940  " if (0 == strcmp(\"NON\", givtcContText))\n" \
25941  " {\n" \
25942  " memcpy(buf_pos, pt_debut_liste, (pt_fin_element - pt_debut_liste));\n" \
25943  " lg_ecr = (pt_fin_element - pt_debut_liste);\n" \
25944  " }\n" \
25945  " else\n" \
25946  " {\n" \
25947  " buf_pos = (buf_pos + lg_ecr);\n" \
25948  " *buf_pos = SEPARE_LIGNE;\n" \
25949  " *(buf_pos + 1) = LINE_FEED;\n" \
25950  " *(buf_pos + 2) = '\\0';\n" \
25951  " buf_pos = (buf_pos + 2);\n" \
25952  " strcpy(buf_pos, \"<contenu>\");\n" \
25953  " buf_pos = buf_pos + strlen(\"<contenu>\");\n" \
25954  " memcpy(buf_pos, pt_debut_liste, (pt_fin_element - pt_debut_liste));\n" \
25955  " lg_ecr = (pt_fin_element - pt_debut_liste);\n" \
25956  " buf_pos = (buf_pos + lg_ecr);\n" \
25957  " strcpy(buf_pos, \"</contenu>\");\n" \
25958  " lg_ecr = strlen(\"</contenu>\");\n" \
25959  " }\n" \
25960  "\n" \
25961  " buf_pos = (buf_pos + lg_ecr);\n" \
25962  " *buf_pos = '\\0';\n" \
25963  " pt_fin_element += strlen(\"</surface>\");\n" \
25964  " pt_fin_liste = pt_fin_element;\n" \
25965  " }\n" \
25966  " else if ((0 == memcmp(pt_debut_element, \"<terme>\", strlen(\"<terme>\"))) && (0 != strcmp(\"MO\", apcType)))\n" \
25967  " {\n" \
25968  " pt_debut_liste = strchr(pt_debut_element + 1, '<');\n" \
25969  " memcpy(buf_pos, pt_fin_liste, (pt_debut_element - pt_fin_liste));\n" \
25970  " lg_ecr = (pt_debut_element - pt_fin_liste);\n" \
25971  " buf_pos = (buf_pos + lg_ecr);\n" \
25972  " *buf_pos = '\\0';\n" \
25973  " /* suppression */\n" \
25974  " pt_fin_element = pt_debut_liste;\n" \
25975  " pt_fin_liste = pt_fin_element;\n" \
25976  " }\n" \
25977  " else if ((0 == memcmp(pt_debut_element, \"</terme>\", strlen(\"</terme>\"))) && (0 != strcmp(\"MO\", apcType)))\n" \
25978  " {\n" \
25979  " pt_debut_liste = strchr(pt_debut_element, '>');\n" \
25980  " pt_debut_liste++;\n" \
25981  " memcpy(buf_pos, pt_fin_liste, (pt_debut_element - pt_fin_liste));\n" \
25982  " lg_ecr = (pt_debut_element - pt_fin_liste);\n" \
25983  " buf_pos = (buf_pos + lg_ecr);\n" \
25984  " *buf_pos = '\\0';\n" \
25985  " /* remplacement par /text */\n" \
25986  " strcpy(buf_pos, \"</text>\");\n" \
25987  " buf_pos = buf_pos + strlen(\"</text>\");\n" \
25988  " pt_fin_element = pt_debut_liste;\n" \
25989  " pt_fin_liste = pt_fin_element;\n" \
25990  " }\n" \
25991  " else\n" \
25992  " {\n" \
25993  " pt_debut_liste = strchr(pt_debut_element, '>');\n" \
25994  " pt_debut_liste++;\n" \
25995  " memcpy(buf_pos, pt_fin_liste, (pt_debut_liste - pt_fin_liste));\n" \
25996  " lg_ecr = (pt_debut_liste - pt_fin_liste);\n" \
25997  " buf_pos = (buf_pos + lg_ecr);\n" \
25998  " *buf_pos = '\\0';\n" \
25999  " /* suite */\n" \
26000  " pt_fin_element = pt_debut_liste;\n" \
26001  " pt_fin_liste = pt_fin_element;\n" \
26002  " }\n" \
26003  " }\n" \
26004  "\n" \
26005  " *buf_pos_in = buf_pos;\n" \
26006  " return (iCodRet);\n" \
26007  "}\n" \
26008  "\n" \
26009  "/*----Fonction----------------------------------------------------------------*/\n" \
26010  "/* */\n" \
26011  "/* Fonction : givAnalyseTerme() */\n" \
26012  "/* */\n" \
26013  "/* But : analyse des objets terme dans un fichier SGIPRO */\n" \
26014  "/* modification au format mongoDB */\n" \
26015  "/* Entree(s) : chaîne */\n" \
26016  "/* */\n" \
26017  "/* Sortie(s) : OK ou KO */\n" \
26018  "/* */\n" \
26019  "/* Portable : Transparent */\n" \
26020  "/* */\n" \
26021  "/* Modification : */\n" \
26022  "/*----------------------------------------------------------------------------*/\n" \
26023  "\n" \
26024  "static int4 givAnalyseTerme(char* apcChaine)\n" \
26025  "{\n" \
26026  " int4 iCodRet = (int4)GIV::GIXCodeKO; /* Code retour de la fonction */\n" \
26027  " char* pcDeb, *pcFin, *pcDebStr, *pcFinStr;\n" \
26028  " GWTTrace(GWT_NIV_FONCT, (\"0 Test Texte/Contenu ... %s\\n\", apcChaine));\n" \
26029  " pcDeb = strstr(apcChaine, \"<terme>\");\n" \
26030  "\n" \
26031  " if ((0 != pcDeb) && (0 == strcmp(\"NON\", givtcContText)))\n" \
26032  " {\n" \
26033  " /* balise supprimée */\n" \
26034  " *apcChaine = '\\0';\n" \
26035  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
26036  " return (iCodRet);\n" \
26037  " }\n" \
26038  " else if (0 != pcDeb)\n" \
26039  " {\n" \
26040  " /* balise remplacée */\n" \
26041  " pcDeb += strlen(\"<terme>\");\n" \
26042  " pcFin = apcChaine + strlen(apcChaine);\n" \
26043  " (void)strcpy(apcChaine, \"<text>\");\n" \
26044  " memmove(apcChaine + strlen(\"<text>\"), pcDeb, pcFin - pcDeb);\n" \
26045  " *(apcChaine + strlen(\"<text>\") + (pcFin - pcDeb)) = '\\0';\n" \
26046  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
26047  " return (iCodRet);\n" \
26048  " }\n" \
26049  "\n" \
26050  " pcDeb = strstr(apcChaine, \"<surface>\");\n" \
26051  "\n" \
26052  " if ((0 != pcDeb) && (0 == strcmp(\"NON\", givtcContText)))\n" \
26053  " {\n" \
26054  " /* balise remplacée */\n" \
26055  " pcDeb += strlen(\"<surface>\");\n" \
26056  " pcFin = strstr(apcChaine, \"</surface>\");\n" \
26057  " pcFinStr = apcChaine + strlen(apcChaine);\n" \
26058  "\n" \
26059  " if (0 == pcFin)\n" \
26060  " {\n" \
26061  " pcFin = pcFinStr;\n" \
26062  " pcDebStr = pcFin;\n" \
26063  " }\n" \
26064  " else\n" \
26065  " {\n" \
26066  " /* balise supprimée */\n" \
26067  " pcDebStr = pcFin + strlen(\"</surface>\");\n" \
26068  " }\n" \
26069  "\n" \
26070  " (void)strcpy(apcChaine, \"<text>\");\n" \
26071  " memmove(apcChaine + strlen(\"<text>\"), pcDeb, pcFin - pcDeb);\n" \
26072  " memmove(apcChaine + strlen(\"<text>\") + (pcFin - pcDeb), pcDebStr, pcFinStr - pcDebStr);\n" \
26073  " *(apcChaine + strlen(\"<text>\") + (pcFin - pcDeb) + (pcFinStr - pcDebStr)) = '\\0';\n" \
26074  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
26075  " return (iCodRet);\n" \
26076  " }\n" \
26077  " else if (0 != pcDeb)\n" \
26078  " {\n" \
26079  " /* balise remplacée */\n" \
26080  " pcDeb += strlen(\"<surface>\");\n" \
26081  " pcFin = strstr(apcChaine, \"</surface>\");\n" \
26082  " pcFinStr = apcChaine + strlen(apcChaine);\n" \
26083  "\n" \
26084  " if (0 == pcFin)\n" \
26085  " {\n" \
26086  " pcFin = pcFinStr;\n" \
26087  " pcDebStr = pcFin;\n" \
26088  " }\n" \
26089  " else\n" \
26090  " {\n" \
26091  " /* balise supprimée */\n" \
26092  " pcDebStr = pcFin + strlen(\"</surface>\");\n" \
26093  " }\n" \
26094  "\n" \
26095  " memmove(apcChaine + strlen(\"<contenu>\"), pcDeb, pcFin - pcDeb);\n" \
26096  "\n" \
26097  " if (pcFin == pcFinStr)\n" \
26098  " {\n" \
26099  " memmove(apcChaine + strlen(\"<contenu>\") + (pcFin - pcDeb), pcDebStr, pcFinStr - pcDebStr);\n" \
26100  " (void)memcpy(apcChaine, \"<contenu>\", strlen(\"<contenu>\"));\n" \
26101  " *(apcChaine + strlen(\"<contenu>\") + (pcFin - pcDeb) + (pcFinStr - pcDebStr)) = '\\0';\n" \
26102  " }\n" \
26103  " else\n" \
26104  " {\n" \
26105  " memmove(apcChaine + strlen(\"<contenu>\") + strlen(\"</contenu>\") + (pcFin - pcDeb), pcDebStr, pcFinStr - pcDebStr);\n" \
26106  " (void)memcpy(apcChaine, \"<contenu>\", strlen(\"<contenu>\"));\n" \
26107  " (void)memcpy(apcChaine + strlen(\"<contenu>\") + (pcFin - pcDeb), \"</contenu>\", strlen(\"</contenu>\"));\n" \
26108  " *(apcChaine + strlen(\"<contenu>\") + strlen(\"</contenu>\") + (pcFin - pcDeb) + (pcFinStr - pcDebStr)) = '\\0';\n" \
26109  " }\n" \
26110  "\n" \
26111  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
26112  " return (iCodRet);\n" \
26113  " }\n" \
26114  "\n" \
26115  " pcDeb = strstr(apcChaine, \"<text>\");\n" \
26116  "\n" \
26117  " if ((0 != pcDeb) && (0 == strcmp(\"OUI\", givtcContText)))\n" \
26118  " {\n" \
26119  " /* balise remplacée */\n" \
26120  " pcDeb += strlen(\"<text>\");\n" \
26121  " pcFin = strstr(apcChaine, \"</text>\");\n" \
26122  " pcFinStr = apcChaine + strlen(apcChaine);\n" \
26123  "\n" \
26124  " if (0 == pcFin)\n" \
26125  " {\n" \
26126  " pcFin = pcFinStr;\n" \
26127  " pcDebStr = pcFin;\n" \
26128  " }\n" \
26129  " else\n" \
26130  " {\n" \
26131  " /* balise supprimée */\n" \
26132  " pcDebStr = pcFin + strlen(\"</text>\");\n" \
26133  " }\n" \
26134  "\n" \
26135  " memmove(apcChaine + strlen(\"<contenu>\"), pcDeb, pcFin - pcDeb);\n" \
26136  " GWTTrace(GWT_NIV_FONCT, (\"1 Test Texte/Contenu ... %s\\n\", apcChaine));\n" \
26137  "\n" \
26138  " if (pcFin == pcFinStr)\n" \
26139  " {\n" \
26140  " memmove(apcChaine + strlen(\"<contenu>\") + (pcFin - pcDeb), pcDebStr, pcFinStr - pcDebStr);\n" \
26141  " (void)memcpy(apcChaine, \"<contenu>\", strlen(\"<contenu>\"));\n" \
26142  " *(apcChaine + strlen(\"<contenu>\") + (pcFin - pcDeb) + (pcFinStr - pcDebStr)) = '\\0';\n" \
26143  " }\n" \
26144  " else if (0 == strchr(pcDebStr, '<'))\n" \
26145  " {\n" \
26146  " memmove(apcChaine + strlen(\"<contenu>\") + strlen(\"</contenu>\") + (pcFin - pcDeb), pcDebStr, pcFinStr - pcDebStr);\n" \
26147  " (void)memcpy(apcChaine, \"<contenu>\", strlen(\"<contenu>\"));\n" \
26148  " (void)memcpy(apcChaine + strlen(\"<contenu>\") + (pcFin - pcDeb), \"</contenu>\", strlen(\"</contenu>\"));\n" \
26149  " *(apcChaine + strlen(\"<contenu>\") + strlen(\"</contenu>\") + (pcFin - pcDeb) + (pcFinStr - pcDebStr)) = '\\0';\n" \
26150  " }\n" \
26151  " else\n" \
26152  " {\n" \
26153  " memmove(apcChaine + strlen(\"<contenu>\") + strlen(\"</contenu>\") + strlen(\"</text>\") + (pcFin - pcDeb), pcDebStr, pcFinStr - pcDebStr);\n" \
26154  " (void)memcpy(apcChaine, \"<contenu>\", strlen(\"<contenu>\"));\n" \
26155  " (void)memcpy(apcChaine + strlen(\"<contenu>\") + (pcFin - pcDeb), \"</contenu></text>\", strlen(\"</contenu></text>\"));\n" \
26156  " *(apcChaine + strlen(\"<contenu>\") + strlen(\"</contenu>\") + strlen(\"</text>\") + (pcFin - pcDeb) + (pcFinStr - pcDebStr)) = '\\0';\n" \
26157  " }\n" \
26158  "\n" \
26159  " GWTTrace(GWT_NIV_FONCT, (\"2 Test Texte/Contenu ... %s\\n\", apcChaine));\n" \
26160  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
26161  " return (iCodRet);\n" \
26162  " }\n" \
26163  "\n" \
26164  " pcDeb = strstr(apcChaine, \"</surface>\");\n" \
26165  "\n" \
26166  " if ((0 != pcDeb) && (0 == strcmp(\"NON\", givtcContText)))\n" \
26167  " {\n" \
26168  " /* balise supprimée */\n" \
26169  " pcDebStr = pcDeb + strlen(\"</surface>\");\n" \
26170  " pcFinStr = apcChaine + strlen(apcChaine);\n" \
26171  " memmove(pcDeb, pcDebStr, pcFinStr - pcDebStr);\n" \
26172  " *(pcDeb + (pcFinStr - pcDebStr)) = '\\0';\n" \
26173  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
26174  " return (iCodRet);\n" \
26175  " }\n" \
26176  " else if (0 != pcDeb)\n" \
26177  " {\n" \
26178  " /* balise remplacée */\n" \
26179  " pcDeb += strlen(\"</surface>\");\n" \
26180  " pcFin = apcChaine + strlen(apcChaine);\n" \
26181  " memmove(apcChaine + strlen(\"</contenu>\"), pcDeb, pcFin - pcDeb);\n" \
26182  " (void)memcpy(apcChaine, \"</contenu>\", strlen(\"</contenu>\"));\n" \
26183  " *(apcChaine + strlen(\"</contenu>\") + (pcFin - pcDeb)) = '\\0';\n" \
26184  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
26185  " return (iCodRet);\n" \
26186  " }\n" \
26187  "\n" \
26188  " pcDeb = strstr(apcChaine, \"</terme>\");\n" \
26189  "\n" \
26190  " if (0 != pcDeb)\n" \
26191  " {\n" \
26192  " /* balise remplacée */\n" \
26193  " pcDeb += strlen(\"</terme>\");\n" \
26194  " pcFin = apcChaine + strlen(apcChaine);\n" \
26195  " (void)strcpy(apcChaine, \"</text>\");\n" \
26196  " memmove(apcChaine + strlen(\"</text>\"), pcDeb, pcFin - pcDeb);\n" \
26197  " *(apcChaine + strlen(\"</text>\") + (pcFin - pcDeb)) = '\\0';\n" \
26198  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
26199  " return (iCodRet);\n" \
26200  " }\n" \
26201  "\n" \
26202  " pcDeb = strstr(apcChaine, \"</text>\");\n" \
26203  "\n" \
26204  " if ((0 != pcDeb) && (0 == strcmp(\"OUI\", givtcContText)))\n" \
26205  " {\n" \
26206  " /* balise remplacée */\n" \
26207  " pcDebStr = pcDeb;\n" \
26208  " pcDeb += strlen(\"</text>\");\n" \
26209  " pcFin = apcChaine + strlen(apcChaine);\n" \
26210  " /* modif */\n" \
26211  " pcFinStr = strchr(pcDeb, '<');\n" \
26212  "\n" \
26213  " if (0 == pcFinStr)\n" \
26214  " {\n" \
26215  " memmove(pcDebStr + strlen(\"</contenu>\"), pcDeb, pcFin - pcDeb);\n" \
26216  " (void)memcpy(pcDebStr, \"</contenu>\", strlen(\"</contenu>\"));\n" \
26217  " *(pcDebStr + strlen(\"</contenu>\") + (pcFin - pcDeb)) = '\\0';\n" \
26218  " }\n" \
26219  " else\n" \
26220  " {\n" \
26221  " memmove(pcDebStr + strlen(\"</contenu>\") + strlen(\"</text>\"), pcDeb, pcFin - pcDeb);\n" \
26222  " (void)memcpy(pcDebStr, \"</contenu>\", strlen(\"</contenu>\"));\n" \
26223  " (void)memcpy(pcDebStr + strlen(\"</contenu>\"), \"</text>\", strlen(\"</text>\"));\n" \
26224  " *(pcDebStr + strlen(\"</contenu>\") + strlen(\"</text>\") + (pcFin - pcDeb)) = '\\0';\n" \
26225  " }\n" \
26226  "\n" \
26227  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
26228  " return (iCodRet);\n" \
26229  " }\n" \
26230  " else if ((0 != pcDeb) && (0 == strcmp(\"OUI\", givtcContText)) && (pcDeb != apcChaine))\n" \
26231  " {\n" \
26232  " /* balise remplacée */\n" \
26233  " pcDeb += strlen(\"</text>\");\n" \
26234  " pcFin = apcChaine + strlen(apcChaine);\n" \
26235  " memmove(pcDeb + strlen(\"</contenu>\") - strlen(\"</text>\"), pcDeb, pcFin - pcDeb);\n" \
26236  " (void)memcpy(pcDeb - strlen(\"</text>\"), \"</contenu>\", strlen(\"</contenu>\"));\n" \
26237  " *(pcDeb + strlen(\"</contenu>\") - strlen(\"</text>\") + (pcFin - pcDeb)) = '\\0';\n" \
26238  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
26239  " return (iCodRet);\n" \
26240  " }\n" \
26241  "\n" \
26242  " return (iCodRet);\n" \
26243  "}\n" \
26244  "\n" \
26245  "/*----Fonction----------------------------------------------------------------*/\n" \
26246  "/* */\n" \
26247  "/* Fonction : givAnalyseCRC() */\n" \
26248  "/* */\n" \
26249  "/* But : analyse CRC dans un fichier SGIPRO */\n" \
26250  "/* modification de balise normale en SCG_ */\n" \
26251  "/* . selon rubrique du bloc */\n" \
26252  "/* . selon analyse de fichier GS */\n" \
26253  "/* . selon priorité */\n" \
26254  "/* Entree(s) : etab,an9,CRC */\n" \
26255  "/* */\n" \
26256  "/* Sortie(s) : OK ou KO */\n" \
26257  "/* */\n" \
26258  "/* Portable : Transparent */\n" \
26259  "/* */\n" \
26260  "/* Modification : */\n" \
26261  "/*----------------------------------------------------------------------------*/\n" \
26262  "\n" \
26263  "static int4 givAnalyseCRC(char* apcType, int4 aiRef, GYBrDOCUMENTEpj* doc, char* apcCRC, char* apcBalise, char* apcBaliseFin)\n" \
26264  "\n" \
26265  "{\n" \
26266  " int4 iIntRet, iCodRet = (int4)GIV::GIXCodeKO; /* Code retour de la fonction */\n" \
26267  " int4 iRet;\n" \
26268  " int4 i, j;\n" \
26269  " char* pcStr, *pcDeb, *pcFin, *pcDebStr, *pcFinStr;\n" \
26270  " int4 iLg;\n" \
26271  " GYBrPrioCRCT rPrioCRC;\n" \
26272  " char tcAn9Courant[GYBPaprofLgCodan9 + 1];\n" \
26273  " (void)strcpy(rPrioCRC.acTpdsob, apcType);\n" \
26274  " rPrioCRC.acType[0] = '\\0';\n" \
26275  " (void)strcpy(rPrioCRC.acEtab, doc->value.a_classer.etab);\n" \
26276  " (void)strcpy(rPrioCRC.acCodan8, givcR000000);\n" \
26277  " pcDeb = strstr(apcCRC, \"<normale\");\n" \
26278  " strcpy(apcBalise, \"\");\n" \
26279  " strcpy(apcBaliseFin, \"\");\n" \
26280  "\n" \
26281  " if (0 == pcDeb)\n" \
26282  " {\n" \
26283  " /* pas de balise normale correcte : sans changement */\n" \
26284  " for (i = 0; (i < givNbCVI && ((0 != strcmp(givTabCVI[i], doc->value.objets_pub.micro[aiRef].stype)) || (2 != doc->value.objets_pub.micro[aiRef].iCVI))); i++)\n" \
26285  " ;\n" \
26286  "\n" \
26287  " if ((givNbCVI != i) || (0 == strcmp(\"DV\", apcType)) || (0 == strcmp(\"MO\", apcType)))\n" \
26288  " {\n" \
26289  " /* pas de traitement de \"terme\" pour CVIV nouvelle ou fichier DV ou Mot Clé */\n" \
26290  " return (iCodRet);\n" \
26291  " }\n" \
26292  "\n" \
26293  " pcDeb = strstr(apcCRC, \"<text>\");\n" \
26294  " pcStr = strstr(apcCRC, \"<surface>\");\n" \
26295  "\n" \
26296  " if (0 == pcStr)\n" \
26297  " pcStr = strstr(apcCRC, \"</surface>\");\n" \
26298  "\n" \
26299  " if ((0 != pcDeb) && (0 == strcmp(\"OUI\", givtcContText)))\n" \
26300  " {\n" \
26301  " /* analyse des blocs \"texte\" */\n" \
26302  " strcpy(apcBalise, \"text\");\n" \
26303  " }\n" \
26304  "\n" \
26305  " /* analyse des blocs \"terme\" */\n" \
26306  " iIntRet = givAnalyseTerme(apcCRC);\n" \
26307  " /* analyse des blocs \"texte\" */\n" \
26308  " pcDeb = strstr(apcCRC, \"</contenu>\");\n" \
26309  "\n" \
26310  " if ((0 != pcDeb) && (0 == pcStr) && (0 == strcmp(\"OUI\", givtcContText)))\n" \
26311  " {\n" \
26312  " pcDeb = strstr(apcCRC, \"</text>\");\n" \
26313  "\n" \
26314  " if (0 == pcDeb)\n" \
26315  " strcpy(apcBaliseFin, \"text\");\n" \
26316  " }\n" \
26317  "\n" \
26318  " GWTTrace(GWT_NIV_FONCT, (\"Balise Text <%s> <%s> <%s>\\n\", apcCRC, apcBalise, apcBaliseFin));\n" \
26319  " return (iCodRet);\n" \
26320  " }\n" \
26321  " else\n" \
26322  " {\n" \
26323  " pcFin = strstr(pcDeb, \">\");\n" \
26324  "\n" \
26325  " if (0 == pcFin)\n" \
26326  " {\n" \
26327  " /* pas de balise normale correcte : sans changement */\n" \
26328  " return (iCodRet);\n" \
26329  " }\n" \
26330  "\n" \
26331  " pcStr = pcDeb;\n" \
26332  " pcDebStr = strstr(pcDeb, \" type=\\\"\");\n" \
26333  "\n" \
26334  " if ((0 != pcDebStr) && (pcDebStr < pcFin))\n" \
26335  " {\n" \
26336  " pcStr = pcDebStr + strlen(\" type=\\\"\");\n" \
26337  "\n" \
26338  " if ('\"' != *pcStr)\n" \
26339  " {\n" \
26340  " pcFinStr = strstr(pcStr, \"\\\"\");\n" \
26341  "\n" \
26342  " if (0 != pcFinStr)\n" \
26343  " {\n" \
26344  " if (GYBLgPrioType2 <= (pcFinStr - pcStr))\n" \
26345  " {\n" \
26346  " memcpy(rPrioCRC.acType, pcStr, GYBLgPrioType2 - 1);\n" \
26347  " rPrioCRC.acType[GYBLgPrioType2 - 1] = '\\0';\n" \
26348  " }\n" \
26349  " else\n" \
26350  " {\n" \
26351  " memcpy(rPrioCRC.acType, pcStr, pcFinStr - pcStr);\n" \
26352  " rPrioCRC.acType[pcFinStr - pcStr] = '\\0';\n" \
26353  " }\n" \
26354  " }\n" \
26355  " }\n" \
26356  " }\n" \
26357  "\n" \
26358  " pcDebStr = strstr(pcDeb, \" an8=\\\"\");\n" \
26359  "\n" \
26360  " if ((0 != pcDebStr) && (pcDebStr < pcFin))\n" \
26361  " {\n" \
26362  " pcStr = pcDebStr + strlen(\" an8=\\\"\");\n" \
26363  "\n" \
26364  " if ('\"' != *pcStr)\n" \
26365  " {\n" \
26366  " pcFinStr = strstr(pcStr, \"\\\"\");\n" \
26367  "\n" \
26368  " if (0 != pcFinStr)\n" \
26369  " {\n" \
26370  " if (GYBIaprofLgCodan8 <= (pcFinStr - pcStr))\n" \
26371  " memcpy(rPrioCRC.acCodan8, pcFinStr - GYBIaprofLgCodan8, GYBIaprofLgCodan8);\n" \
26372  " else\n" \
26373  " memcpy(&rPrioCRC.acCodan8[GYBIaprofLgCodan8 - (pcFinStr - pcStr)], pcStr, pcFinStr - pcStr);\n" \
26374  "\n" \
26375  " /* rubrique cadrée sur 6 caractères */\n" \
26376  " iLg = GYBPaprofLgCodan8 + strlen(pcFinStr);\n" \
26377  " memmove(pcStr + GYBIaprofLgCodan8, pcFinStr, strlen(pcFinStr));\n" \
26378  " memcpy(pcStr, rPrioCRC.acCodan8, GYBIaprofLgCodan8);\n" \
26379  " *(pcStr + iLg) = '\\0';\n" \
26380  " }\n" \
26381  " }\n" \
26382  " }\n" \
26383  "\n" \
26384  " pcStr = strstr(pcStr, \">\");\n" \
26385  " }\n" \
26386  "\n" \
26387  " pcStr = pcStr + strlen(\">\");\n" \
26388  " GWTTrace(GWT_NIV_FONCT, (\" Analyse SCG_... %s\\n\", rPrioCRC.acCodan8));\n" \
26389  " /* recherche de la rubrique de CRC hors exception parmi les rubriques du bloc */\n" \
26390  " i = 0;\n" \
26391  "\n" \
26392  " if ((NULL == strstr(givtcExceptCont, rPrioCRC.acCodan8)) && (0 != strcmp(\"EE\", apcType)) && (0 != strcmp(\"EM\", apcType)) && (0 != strcmp(\"MO\", apcType)))\n" \
26393  " {\n" \
26394  " if (-1 != aiRef)\n" \
26395  " {\n" \
26396  " /* inclusion par objet */\n" \
26397  " iRet = givInclusionRubrique(rPrioCRC.acCodan8, doc, aiRef);\n" \
26398  "\n" \
26399  " if ((int4)GIV::GWCCodeKO == iRet)\n" \
26400  " {\n" \
26401  " /* pas d'inclusion dans les rubriques de l'objet */\n" \
26402  " i = givrListParu.iNbr;\n" \
26403  " }\n" \
26404  " }\n" \
26405  " else\n" \
26406  " {\n" \
26407  " /* inclusion par bloc */\n" \
26408  " strcpy(tcAn9Courant, givcR00000000);\n" \
26409  "\n" \
26410  " for (i = 0; i < (givrListParu.iNbr); i++)\n" \
26411  " {\n" \
26412  " j = givrListParu.trEltRangList[i];\n" \
26413  "\n" \
26414  " if (0 != strcmp(tcAn9Courant, givrListParu.trEltList[j].rub))\n" \
26415  " {\n" \
26416  " strcpy(tcAn9Courant, givrListParu.trEltList[j].rub);\n" \
26417  "\n" \
26418  " if (0 == strcmp(rPrioCRC.acCodan8, givrListParu.trEltList[j].rubinit))\n" \
26419  " break;\n" \
26420  " }\n" \
26421  " }\n" \
26422  " }\n" \
26423  " }\n" \
26424  "\n" \
26425  " if ((givrListParu.iNbr == i) && (0 != strcmp(givcR000000, rPrioCRC.acCodan8)))\n" \
26426  " {\n" \
26427  " /* rubrique de CRC absente des rubriques du bloc */\n" \
26428  " /* balise CRC marquée supprimée */\n" \
26429  " GWTTrace(GWT_NIV_FONCT, (\" SCG_IAPROF... %s\\n\", apcCRC));\n" \
26430  " iLg = strlen(apcCRC);\n" \
26431  " memmove(pcStr + strlen(\"SCG_\"), pcStr, strlen(pcStr));\n" \
26432  " memcpy(pcStr, \"SCG_\", strlen(\"SCG_\"));\n" \
26433  " *(apcCRC + iLg + strlen(\"SCG_\")) = '\\0';\n" \
26434  " GWTTrace(GWT_NIV_FONCT, (\" SCG_IAPROF... %s\\n\", apcCRC));\n" \
26435  " return (iCodRet);\n" \
26436  " }\n" \
26437  "\n" \
26438  " if ((0 == strcmp(\"GS\", apcType)) && (0 != strcmp(givcR000000, rPrioCRC.acCodan8)))\n" \
26439  " {\n" \
26440  " /* liste d'opposition CRC de fichier GS */\n" \
26441  " iCodRet = givOppositionURLGratuite(doc->value.a_classer.etab, rPrioCRC.acCodan8);\n" \
26442  "\n" \
26443  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
26444  " {\n" \
26445  " /* fichier non inclus */\n" \
26446  " return (iCodRet);\n" \
26447  " }\n" \
26448  " }\n" \
26449  "\n" \
26450  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
26451  " /* priorité du CRC du fichier contenu */\n" \
26452  " pcFinStr = strstr(pcStr, \"</normale>\");\n" \
26453  "\n" \
26454  " if (0 == pcFinStr)\n" \
26455  " {\n" \
26456  " /* balise absente : sans changement */\n" \
26457  " return (iCodRet);\n" \
26458  " }\n" \
26459  " else if ((pcFinStr - pcStr) < 0)\n" \
26460  " {\n" \
26461  " /* balise absente : sans changement */\n" \
26462  " return (iCodRet);\n" \
26463  " }\n" \
26464  "\n" \
26465  " /* CRC */\n" \
26466  " if (GYBLgPrioCRC2 <= (pcFinStr - pcStr))\n" \
26467  " {\n" \
26468  " memcpy(rPrioCRC.acCRC, pcStr, GYBLgPrioCRC2 - 1);\n" \
26469  " rPrioCRC.acCRC[GYBLgPrioCRC2 - 1] = '\\0';\n" \
26470  " }\n" \
26471  " else\n" \
26472  " {\n" \
26473  " memcpy(rPrioCRC.acCRC, pcStr, pcFinStr - pcStr);\n" \
26474  " rPrioCRC.acCRC[pcFinStr - pcStr] = '\\0';\n" \
26475  " }\n" \
26476  "\n" \
26477  " if (0 != strcmp(\"MO\", apcType))\n" \
26478  " {\n" \
26479  " /* analyse du black-listage en liste réponse */\n" \
26480  " iCodRet = givLectureBListCRCLR(&rPrioCRC);\n" \
26481  "\n" \
26482  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
26483  " {\n" \
26484  " /* balise CRC marquée supprimée */\n" \
26485  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
26486  " GWTTrace(GWT_NIV_FONCT, (\" SCG_BL_LR... %s\\n\", apcCRC));\n" \
26487  " iLg = strlen(apcCRC);\n" \
26488  " memmove(pcStr + strlen(\"SCG_\"), pcStr, strlen(pcStr));\n" \
26489  " memcpy(pcStr, \"SCG_\", strlen(\"SCG_\"));\n" \
26490  " *(apcCRC + iLg + strlen(\"SCG_\")) = '\\0';\n" \
26491  " GWTTrace(GWT_NIV_FONCT, (\" SCG_BL_LR... %s\\n\", apcCRC));\n" \
26492  " return (iCodRet);\n" \
26493  " }\n" \
26494  "\n" \
26495  " /* analyse du black-listage en fiche détaillée */\n" \
26496  " iCodRet = givLectureBListCRCFD(&rPrioCRC);\n" \
26497  "\n" \
26498  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
26499  " {\n" \
26500  " /* balise CRC marquée supprimée */\n" \
26501  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
26502  " GWTTrace(GWT_NIV_FONCT, (\" SCG_BL_FD... %s\\n\", apcCRC));\n" \
26503  " iLg = strlen(apcCRC);\n" \
26504  " memmove(pcStr + strlen(\"SCG_\"), pcStr, strlen(pcStr));\n" \
26505  " memcpy(pcStr, \"SCG_\", strlen(\"SCG_\"));\n" \
26506  " *(apcCRC + iLg + strlen(\"SCG_\")) = '\\0';\n" \
26507  " GWTTrace(GWT_NIV_FONCT, (\" SCG_BL_FD... %s\\n\", apcCRC));\n" \
26508  " /* balise conservée à l'affichage en fiche détaillée */\n" \
26509  " rPrioCRC.iPrioCRC = GIV::GIXCodeKO;\n" \
26510  " iIntRet = givAjoutListCRC(rPrioCRC);\n" \
26511  " return (iCodRet);\n" \
26512  " }\n" \
26513  " }\n" \
26514  "\n" \
26515  " if ((0 == strcmp(\"GS\", apcType)) && (0 != strcmp(givcR000000, rPrioCRC.acCodan8)))\n" \
26516  " {\n" \
26517  " /* suppression de CRC de fichier GS */\n" \
26518  " iCodRet = givLectureProfURLGratuite(rPrioCRC.acCodan8);\n" \
26519  "\n" \
26520  " for (i = 0; i < nb_micro && !(0 == strcmp(doc->value.objets_pub.micro[i].type, \"X\") && 0 == strcmp(doc->value.objets_pub.micro[i].stype, \" U\")); i++)\n" \
26521  " ;\n" \
26522  "\n" \
26523  " GWTTrace(GWT_NIV_FONCT, (\"GS et U... %d, %d\\n\", i, nb_micro));\n" \
26524  "\n" \
26525  " if ((int4)GIV::GIXCodeKO == iCodRet)\n" \
26526  " {\n" \
26527  " /* balise CRC marquée supprimée */\n" \
26528  " GWTTrace(GWT_NIV_FONCT, (\" SCG_GS... %s\\n\", apcCRC));\n" \
26529  " iLg = strlen(apcCRC);\n" \
26530  " memmove(pcStr + strlen(\"SCG_\"), pcStr, strlen(pcStr));\n" \
26531  " memcpy(pcStr, \"SCG_\", strlen(\"SCG_\"));\n" \
26532  " *(apcCRC + iLg + strlen(\"SCG_\")) = '\\0';\n" \
26533  " GWTTrace(GWT_NIV_FONCT, (\" SCG_GS... %s\\n\", apcCRC));\n" \
26534  " }\n" \
26535  "\n" \
26536  " if (nb_micro != i)\n" \
26537  " {\n" \
26538  " /* coexistence avec type U */\n" \
26539  " /* balise non conservée à l'affichage en fiche détaillée */\n" \
26540  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
26541  " return (iCodRet);\n" \
26542  " }\n" \
26543  " }\n" \
26544  "\n" \
26545  " if (GIV::GWCCodeOK != giviConflitCRC)\n" \
26546  " {\n" \
26547  " /* pas de conflit hors priorité */\n" \
26548  " rPrioCRC.iPrioCRC = GIV::GIXCodeKO;\n" \
26549  " }\n" \
26550  " else\n" \
26551  " {\n" \
26552  " /* conflit si priorité */\n" \
26553  " rPrioCRC.iPrioCRC = GIV::GIXCodeOK;\n" \
26554  " }\n" \
26555  "\n" \
26556  " GWTTrace(GWT_NIV_FONCT, (\" Analyse SCG_... %s\\n\", rPrioCRC.acCRC));\n" \
26557  "\n" \
26558  " for (i = 0; (i < giviNbCRC && GIV::GIXCodeOK == rPrioCRC.iPrioCRC); i++)\n" \
26559  " {\n" \
26560  " /* contenu prioritaire pour la rubrique */\n" \
26561  " if ((0 == strcmp(givrListCRC.trEltList[i].acCodan8, rPrioCRC.acCodan8)) && (0 == strcmp(givrListCRC.trEltList[i].acCRC, rPrioCRC.acCRC)) && (GIV::GIXCodeOK == givrListCRC.trEltList[i].iPrioCRC))\n" \
26562  " {\n" \
26563  " /* balise sans changement */\n" \
26564  " break;\n" \
26565  " }\n" \
26566  " }\n" \
26567  "\n" \
26568  " if (GIV::GIXCodeOK != rPrioCRC.iPrioCRC)\n" \
26569  " {\n" \
26570  " rPrioCRC.iPrioCRC = GIV::GIXCodeKO;\n" \
26571  " iIntRet = givAjoutListCRC(rPrioCRC);\n" \
26572  " }\n" \
26573  " else if (giviNbCRC == i)\n" \
26574  " {\n" \
26575  " iCodRet = givLecturePrioProfCRC(rPrioCRC.acCodan8, rPrioCRC.acCRC);\n" \
26576  "\n" \
26577  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
26578  " {\n" \
26579  " /* contenu soumis à priorité pour la rubrique */\n" \
26580  " for (j = 0; j < giviNbCRC; j++)\n" \
26581  " {\n" \
26582  " /* contenu non prioritaire pour la rubrique */\n" \
26583  " if ((0 == strcmp(givrListCRC.trEltList[j].acCodan8, rPrioCRC.acCodan8)) && (0 != strcmp(givrListCRC.trEltList[j].acTpdsob, rPrioCRC.acTpdsob)) && (GIV::GIXCodeOK == givrListCRC.trEltList[j].iPrioCRC))\n" \
26584  " break;\n" \
26585  " }\n" \
26586  "\n" \
26587  " if (giviNbCRC == j)\n" \
26588  " {\n" \
26589  " /* contenu prioritaire pour la rubrique */\n" \
26590  " /* balise sans changement */\n" \
26591  " iIntRet = givAjoutListCRC(rPrioCRC);\n" \
26592  " }\n" \
26593  " else\n" \
26594  " {\n" \
26595  " /* contenu non prioritaire pour la rubrique */\n" \
26596  " /* balise CRC marquée supprimée */\n" \
26597  " GWTTrace(GWT_NIV_FONCT, (\" SCG_PRIO... %s\\n\", apcCRC));\n" \
26598  " iLg = strlen(apcCRC);\n" \
26599  " memmove(pcStr + strlen(\"SCG_\"), pcStr, strlen(pcStr));\n" \
26600  " memcpy(pcStr, \"SCG_\", strlen(\"SCG_\"));\n" \
26601  " *(apcCRC + iLg + strlen(\"SCG_\")) = '\\0';\n" \
26602  " GWTTrace(GWT_NIV_FONCT, (\" SCG_PRIO... %s\\n\", apcCRC));\n" \
26603  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
26604  " return (iCodRet);\n" \
26605  " }\n" \
26606  " }\n" \
26607  " else\n" \
26608  " {\n" \
26609  " rPrioCRC.iPrioCRC = GIV::GIXCodeKO;\n" \
26610  " iIntRet = givAjoutListCRC(rPrioCRC);\n" \
26611  " }\n" \
26612  "\n" \
26613  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
26614  " }\n" \
26615  " else if (0 != strcmp(givrListCRC.trEltList[i].acEtab, rPrioCRC.acEtab))\n" \
26616  " {\n" \
26617  " rPrioCRC.iPrioCRC = GIV::GIXCodeKO;\n" \
26618  " iIntRet = givAjoutListCRC(rPrioCRC);\n" \
26619  " }\n" \
26620  "\n" \
26621  " givrListCRC.iNbr = giviNbCRC;\n" \
26622  " return (iCodRet);\n" \
26623  "}\n" \
26624  "\n" \
26625  "/*----Fonction----------------------------------------------------------------*/\n" \
26626  "/* */\n" \
26627  "/* Fonction : givEcritContenuED() */\n" \
26628  "/* */\n" \
26629  "/* But : ecrit les contenus SGIPRO */\n" \
26630  "/* */\n" \
26631  "/* */\n" \
26632  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
26633  "/* */\n" \
26634  "/* Sortie(s) : OK ou KO */\n" \
26635  "/* */\n" \
26636  "/* Portable : Transparent */\n" \
26637  "/* */\n" \
26638  "/* Modification (Jui/20/2006 - mb) : création de plusieurs fichiers de sortie */\n" \
26639  "/*----------------------------------------------------------------------------*/\n" \
26640  "\n" \
26641  "static int4 givEcritContenuED(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice)\n" \
26642  "\n" \
26643  "{\n" \
26644  " int4 lg_ecr_micro = 0;\n" \
26645  " int4 lg_ecr = 0;\n" \
26646  " int4 i = 0;\n" \
26647  " int4 j = 0;\n" \
26648  " int4 k = 0;\n" \
26649  " int4 l = 0;\n" \
26650  " int4 iDebut;\n" \
26651  " int4 lg_write;\n" \
26652  " char* buf_pos;\n" \
26653  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
26654  " int4 lg_a_ecrire;\n" \
26655  " /* Pointeur sur debut du buffer */\n" \
26656  " buf_pos = *buf_pos_in;\n" \
26657  "\n" \
26658  " /* Ecriture dans le fichier de sortie */\n" \
26659  " if ('\\0' != GIVBuffXML[0])\n" \
26660  " {\n" \
26661  " /* Ecriture dans le fichier de sortie */\n" \
26662  " iCodRet = giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
26663  " }\n" \
26664  "\n" \
26665  " *buf_pos_in = buf_pos;\n" \
26666  " iDebut = 1;\n" \
26667  "\n" \
26668  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
26669  " {\n" \
26670  " /* inscription locale */\n" \
26671  " l = givrListParu.trEltRangList[j];\n" \
26672  "\n" \
26673  " if (GIV::giv_LOC == givrListParu.trEltList[l].iGeoLoc)\n" \
26674  " {\n" \
26675  " /* écriture SGIPRO */\n" \
26676  " iCodRet = givEcritSgiProED(\"ED\", \"affedito\", &buf_pos, *buf_pos_in, doc, givrListParu.trEltList[l].rub, givrListParu.trEltList[l].dep, givrListParu.trEltList[l].loc, &iDebut);\n" \
26677  " }\n" \
26678  " }\n" \
26679  "\n" \
26680  " if (buf_pos != *buf_pos_in)\n" \
26681  " {\n" \
26682  " strcpy(buf_pos, \"</sgipro>\");\n" \
26683  " lg_ecr = strlen(buf_pos);\n" \
26684  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
26685  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
26686  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
26687  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
26688  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"affedito\");\n" \
26689  " buf_pos = buf_pos + lg_write;\n" \
26690  " }\n" \
26691  "\n" \
26692  " if ('\\0' != GIVBuffXML[0])\n" \
26693  " {\n" \
26694  " /* Ecriture dans le fichier de sortie */\n" \
26695  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
26696  " }\n" \
26697  "\n" \
26698  " *buf_pos_in = buf_pos;\n" \
26699  " GWTTrace(GWT_NIV_FONCT, (\"Sortie Ecriture Contenu ED\\n\"));\n" \
26700  " return (iCodRet);\n" \
26701  "}\n" \
26702  "\n" \
26703  "/*----Fonction----------------------------------------------------------------*/\n" \
26704  "/* */\n" \
26705  "/* Fonction : givEcritContenuEDEtab() */\n" \
26706  "/* */\n" \
26707  "/* But : ecrit les contenus SGIPRO */\n" \
26708  "/* */\n" \
26709  "/* */\n" \
26710  "/* Entree(s) : un buffer, valeur_id_parution */\n" \
26711  "/* */\n" \
26712  "/* Sortie(s) : OK ou KO */\n" \
26713  "/* */\n" \
26714  "/* Portable : Transparent */\n" \
26715  "/* */\n" \
26716  "/* Modification (Jui/20/2006 - mb) : création de plusieurs fichiers de sortie */\n" \
26717  "/*----------------------------------------------------------------------------*/\n" \
26718  "\n" \
26719  "static int4 givEcritContenuEDEtab(char* obj, char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice)\n" \
26720  "\n" \
26721  "{\n" \
26722  " int4 lg_ecr = 0;\n" \
26723  " int4 i = 0;\n" \
26724  " int4 j = 0;\n" \
26725  " int4 k = 0;\n" \
26726  " int4 l = 0;\n" \
26727  " int4 iDebut;\n" \
26728  " int4 lg_write;\n" \
26729  " char* buf_pos, *buf_pos_ref;\n" \
26730  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
26731  " int4 iRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
26732  " char tcAn9Courant[GYBPaprofLgCodan9 + 1];\n" \
26733  " char* pt_debut_element;\n" \
26734  " char* pt_fin_element;\n" \
26735  " char* pt_fin_liste;\n" \
26736  " char tcType[3 + 1];\n" \
26737  " char tcBalise[50 + 1];\n" \
26738  " char tcBaliseFin[50 + 1];\n" \
26739  " /* Pointeur sur debut du buffer */\n" \
26740  " buf_pos = *buf_pos_in;\n" \
26741  "\n" \
26742  " /* Ecriture dans le fichier de sortie */\n" \
26743  " if ('\\0' != GIVBuffXML[0])\n" \
26744  " {\n" \
26745  " /* Ecriture dans le fichier de sortie */\n" \
26746  " iCodRet = (int4)giv_sortie_ISO(&buf_pos, GIVfDescFicBloc);\n" \
26747  " }\n" \
26748  "\n" \
26749  " strcpy(tcType, obj);\n" \
26750  " strcat(tcType, \"/\");\n" \
26751  " tcBalise[0] = '\\0';\n" \
26752  " pt_debut_element = strstr(givtcObjCont, tcType);\n" \
26753  " pt_fin_liste = givtcObjCont + strlen(givtcObjCont);\n" \
26754  "\n" \
26755  " if (0 != pt_debut_element)\n" \
26756  " {\n" \
26757  " /* pas de balise associée */\n" \
26758  " pt_debut_element += strlen(tcType);\n" \
26759  " pt_fin_element = strchr(pt_debut_element, ',');\n" \
26760  "\n" \
26761  " if (0 != pt_fin_element)\n" \
26762  " {\n" \
26763  " memcpy(tcBalise, (pt_debut_element), (pt_fin_element - pt_debut_element));\n" \
26764  " tcBalise[(pt_fin_element - pt_debut_element)] = '\\0';\n" \
26765  " }\n" \
26766  " else\n" \
26767  " {\n" \
26768  " memcpy(tcBalise, (pt_debut_element), (pt_fin_liste - pt_debut_element));\n" \
26769  " tcBalise[(pt_fin_liste - pt_debut_element)] = '\\0';\n" \
26770  " }\n" \
26771  " }\n" \
26772  "\n" \
26773  " if (0 == strlen(tcBalise))\n" \
26774  " {\n" \
26775  " GWTTrace(GWT_NIV_GRAVE, (\"Balise de contenu non configurée %s\\n\", obj));\n" \
26776  " return (iCodRet);\n" \
26777  " }\n" \
26778  "\n" \
26779  " GWTTrace(GWT_NIV_FONCT, (\"Ecriture Contenu %s,%s\\n\", obj, tcBalise));\n" \
26780  " strcpy(tcType, obj);\n" \
26781  " tcType[0] = toupper(tcType[0]);\n" \
26782  " tcType[1] = toupper(tcType[1]);\n" \
26783  "\n" \
26784  " if ((0 == strcmp(\"ED\", tcType)) || (0 == strcmp(\"EE\", tcType)))\n" \
26785  " {\n" \
26786  " *buf_pos_in = buf_pos;\n" \
26787  " strcpy(tcAn9Courant, givcR00000000);\n" \
26788  " iDebut = 1;\n" \
26789  "\n" \
26790  " for (j = 0; j < (givrListParu.iNbr); j++)\n" \
26791  " {\n" \
26792  " /* inscription à thème */\n" \
26793  " l = givrListParu.trEltRangList[j];\n" \
26794  "\n" \
26795  " if (0 != strcmp(tcAn9Courant, givrListParu.trEltList[l].rub))\n" \
26796  " {\n" \
26797  " strcpy(tcAn9Courant, givrListParu.trEltList[l].rub);\n" \
26798  " /* Appel a la fonction de lecture du theme de rubrique */\n" \
26799  " iCodRet = givLectureThemeED(givrListParu.trEltList[l].rub);\n" \
26800  "\n" \
26801  " if (0 != strlen(buf_concat))\n" \
26802  " {\n" \
26803  " for (i = 0; i < j; i++)\n" \
26804  " {\n" \
26805  " k = givrListParu.trEltRangList[i];\n" \
26806  "\n" \
26807  " if (0 == strcmp(buf_concat, givrListParu.trEltList[k].thm))\n" \
26808  " break;\n" \
26809  " }\n" \
26810  "\n" \
26811  " if (i == j)\n" \
26812  " {\n" \
26813  " i = 0;\n" \
26814  "\n" \
26815  " /* écriture SGIPRO */\n" \
26816  " if (0 == strcmp(tcType, obj))\n" \
26817  " {\n" \
26818  " /* accès à un fichier */\n" \
26819  " iCodRet = givEcritSgiProED(tcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, buf_concat, \"\", \"\", &iDebut);\n" \
26820  " }\n" \
26821  " else\n" \
26822  " {\n" \
26823  " /* accès à la base */\n" \
26824  " iCodRet = givEcritDonEtab(tcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, buf_concat, \"\", \"\", &iDebut);\n" \
26825  " }\n" \
26826  " }\n" \
26827  " }\n" \
26828  "\n" \
26829  " strcpy(givrListParu.trEltList[l].thm, buf_concat);\n" \
26830  " }\n" \
26831  " else\n" \
26832  " strcpy(givrListParu.trEltList[l].thm, \"\");\n" \
26833  " }\n" \
26834  "\n" \
26835  " if (0 == iDebut)\n" \
26836  " {\n" \
26837  " strcpy(buf_pos, \"</sgipro>\");\n" \
26838  " lg_ecr = strlen(buf_pos);\n" \
26839  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
26840  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
26841  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
26842  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
26843  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBalise);\n" \
26844  " buf_pos = buf_pos + lg_write;\n" \
26845  " }\n" \
26846  " }\n" \
26847  " else if (0 == strcmp(\"BB\", tcType))\n" \
26848  " {\n" \
26849  " *buf_pos_in = buf_pos;\n" \
26850  " iDebut = 1;\n" \
26851  " i = 0;\n" \
26852  "\n" \
26853  " /* écriture SGIPRO */\n" \
26854  " if (0 == strcmp(tcType, obj))\n" \
26855  " {\n" \
26856  " /* accès à un fichier */\n" \
26857  " iCodRet = givEcritSgiProED(tcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, \"\", \"\", \"\", &iDebut);\n" \
26858  " }\n" \
26859  " else\n" \
26860  " {\n" \
26861  " /* accès à la base hors service */\n" \
26862  " /* iCodRet = givEcritDonEtab(tcType, tcBalise, &buf_pos, *buf_pos_in, doc+i, \"\", \"\", \"\", &iDebut); */\n" \
26863  " }\n" \
26864  "\n" \
26865  " GWTTrace(GWT_NIV_FONCT, (\"Eciture BB fichier SGIPRO ED : %d\\n\", iDebut));\n" \
26866  "\n" \
26867  " if (0 == iDebut)\n" \
26868  " {\n" \
26869  " strcpy(buf_pos, \"</sgipro>\");\n" \
26870  " lg_ecr = strlen(buf_pos);\n" \
26871  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
26872  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
26873  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
26874  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
26875  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBalise);\n" \
26876  " buf_pos = buf_pos + lg_write;\n" \
26877  "\n" \
26878  " if ('\\0' != GIVBuffXML[0])\n" \
26879  " {\n" \
26880  " /* Ecriture dans le fichier de sortie sans changement de format */\n" \
26881  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
26882  " }\n" \
26883  " }\n" \
26884  " }\n" \
26885  " else if (0 == strcmp(\"EG\", tcType))\n" \
26886  " {\n" \
26887  " *buf_pos_in = buf_pos;\n" \
26888  " iDebut = 1;\n" \
26889  " i = 0;\n" \
26890  "\n" \
26891  " if (-1 == (doc + i)->value.a_classer.iBLEPJProf)\n" \
26892  " {\n" \
26893  " strcpy(tcAn9Courant, givcR00000000);\n" \
26894  " (doc + i)->value.a_classer.iBLEPJProf = 0;\n" \
26895  "\n" \
26896  " for (k = 0; k < (givrListParu.iNbr); k++)\n" \
26897  " {\n" \
26898  " l = givrListParu.trEltRangList[k];\n" \
26899  "\n" \
26900  " if ((0 != strcmp(tcAn9Courant, givrListParu.trEltList[l].rub)) && (0 != strcmp(givrListParu.trEltList[l].rub, givcR00000000)))\n" \
26901  " {\n" \
26902  " strcpy(tcAn9Courant, givrListParu.trEltList[l].rub);\n" \
26903  " /* liste d'opposition CRC de fichier GS */\n" \
26904  " iCodRet = givLectureBListEPJProf((doc + i)->value.a_classer.etab, givrListParu.trEltList[l].rubinit);\n" \
26905  "\n" \
26906  " if ((int4)GIV::GIXCodeKO == iCodRet)\n" \
26907  " {\n" \
26908  " /* balises à inclure */\n" \
26909  " (doc + i)->value.a_classer.iBLEPJProf = 0;\n" \
26910  " break;\n" \
26911  " }\n" \
26912  "\n" \
26913  " (doc + i)->value.a_classer.iBLEPJProf = 1;\n" \
26914  " }\n" \
26915  " }\n" \
26916  " }\n" \
26917  "\n" \
26918  " /* écriture SGIPRO */\n" \
26919  " if (0 == strcmp(tcType, obj))\n" \
26920  " {\n" \
26921  " /* accès à un fichier */\n" \
26922  " iCodRet = givEcritSgiProED(tcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, \"\", \"\", \"\", &iDebut);\n" \
26923  " }\n" \
26924  " else\n" \
26925  " {\n" \
26926  " /* accès à la base */\n" \
26927  " iCodRet = givEcritDonEtab(tcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, \"\", \"\", \"\", &iDebut);\n" \
26928  " }\n" \
26929  "\n" \
26930  " if ((1 == iDebut) && (0 != strlen(doc->value.objets_pub.libUrlSite)))\n" \
26931  " {\n" \
26932  " i = 0;\n" \
26933  " iDebut = 0;\n" \
26934  " lg_write = giv_ecrit_noeud_simple(buf_pos, tcBalise);\n" \
26935  " buf_pos = buf_pos + lg_write;\n" \
26936  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"sgipro\");\n" \
26937  " buf_pos = buf_pos + lg_write;\n" \
26938  " strcat(buf_pos, \"<annonceur etablissement=\\\"\\\" id=\\\"\");\n" \
26939  "\n" \
26940  " if ((0 == strlen((doc + i)->value.a_classer.etab)) && (i + 1 == indice))\n" \
26941  " strcat(buf_pos, (doc + i)->value.numero_client);\n" \
26942  " else\n" \
26943  " strcat(buf_pos, (doc + i)->value.a_classer.etab);\n" \
26944  "\n" \
26945  " strcat(buf_pos, \"\\\">\");\n" \
26946  " lg_ecr = strlen(buf_pos);\n" \
26947  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
26948  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
26949  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
26950  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
26951  " lg_write = giv_ecrit_balise(buf_pos, \"1\", \"prcplt\");\n" \
26952  " buf_pos = buf_pos + lg_write;\n" \
26953  " lg_write = giv_ecrit_balise(buf_pos, \"0\", \"prdura\");\n" \
26954  " buf_pos = buf_pos + lg_write;\n" \
26955  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"infosCpltDonneesEnrichies\");\n" \
26956  " buf_pos = buf_pos + lg_write;\n" \
26957  " lg_write = giv_ecrit_balise(buf_pos, (doc + i)->value.objets_pub.libUrlSite, \"urlSite\");\n" \
26958  " buf_pos = buf_pos + lg_write;\n" \
26959  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"infosCpltDonneesEnrichies\");\n" \
26960  " buf_pos = buf_pos + lg_write;\n" \
26961  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"annonceur\");\n" \
26962  " buf_pos = buf_pos + lg_write;\n" \
26963  " }\n" \
26964  "\n" \
26965  " if (0 == iDebut)\n" \
26966  " {\n" \
26967  " strcpy(buf_pos, \"</sgipro>\");\n" \
26968  " lg_ecr = strlen(buf_pos);\n" \
26969  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
26970  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
26971  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
26972  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
26973  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBalise);\n" \
26974  " buf_pos = buf_pos + lg_write;\n" \
26975  "\n" \
26976  " if ('\\0' != GIVBuffXML[0])\n" \
26977  " {\n" \
26978  " /* Ecriture dans le fichier de sortie sans changement de format */\n" \
26979  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
26980  " }\n" \
26981  " }\n" \
26982  " }\n" \
26983  " else if (0 == strcmp(\"EM\", tcType))\n" \
26984  " {\n" \
26985  " *buf_pos_in = buf_pos;\n" \
26986  " iDebut = 1;\n" \
26987  " i = 0;\n" \
26988  "\n" \
26989  " if (-1 == (doc + i)->value.a_classer.iBLEPJProf)\n" \
26990  " {\n" \
26991  " strcpy(tcAn9Courant, givcR00000000);\n" \
26992  " (doc + i)->value.a_classer.iBLEPJProf = 0;\n" \
26993  "\n" \
26994  " for (k = 0; k < givrListParu.iNbr; k++)\n" \
26995  " {\n" \
26996  " l = givrListParu.trEltRangList[k];\n" \
26997  "\n" \
26998  " if ((0 != strcmp(tcAn9Courant, givrListParu.trEltList[l].rub)) && (0 != strcmp(givrListParu.trEltList[l].rub, givcR00000000)))\n" \
26999  " {\n" \
27000  " strcpy(tcAn9Courant, givrListParu.trEltList[l].rub);\n" \
27001  " /* liste d'opposition CRC de fichier GS */\n" \
27002  " iCodRet = givLectureBListEPJProf((doc + i)->value.a_classer.etab, givrListParu.trEltList[l].rubinit);\n" \
27003  "\n" \
27004  " if ((int4)GIV::GIXCodeKO == iCodRet)\n" \
27005  " {\n" \
27006  " /* fichier à inclure */\n" \
27007  " (doc + i)->value.a_classer.iBLEPJProf = 0;\n" \
27008  " break;\n" \
27009  " }\n" \
27010  "\n" \
27011  " (doc + i)->value.a_classer.iBLEPJProf = 1;\n" \
27012  " }\n" \
27013  " }\n" \
27014  " }\n" \
27015  "\n" \
27016  " if (0 == (doc + i)->value.a_classer.iBLEPJProf)\n" \
27017  " {\n" \
27018  " /* écriture SGIPRO */\n" \
27019  " if (0 == strcmp(tcType, obj))\n" \
27020  " {\n" \
27021  " /* accès à un fichier */\n" \
27022  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
27023  "\n" \
27024  " for (j = 0; j < giviNbProfEtab; j++)\n" \
27025  " {\n" \
27026  " if ((0 == strcmp(givrListProfEtab[j].tcEtab, (doc + i)->value.a_classer.etab)) && ('V' == givrListProfEtab[j].cIndic))\n" \
27027  " {\n" \
27028  " /* accès à un fichier DV avec an8 */\n" \
27029  " iRet = givEcritSgiProED(tcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, givrListProfEtab[j].tcAn8, \"\", \"\", &iDebut);\n" \
27030  "\n" \
27031  " if ('\\0' != GIVBuffXML[0])\n" \
27032  " {\n" \
27033  " /* Ecriture dans le fichier de sortie sans changement de format */\n" \
27034  " iRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27035  " iCodRet = (int4)GIV::GIXCodeOK;\n" \
27036  " }\n" \
27037  " }\n" \
27038  " }\n" \
27039  "\n" \
27040  " if ((int4)GIV::GIXCodeKO == iCodRet)\n" \
27041  " {\n" \
27042  " /* accès à un fichier DE sans an8 */\n" \
27043  " iRet = givEcritSgiProED(tcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, \"\", \"\", \"\", &iDebut);\n" \
27044  " }\n" \
27045  " }\n" \
27046  " else\n" \
27047  " {\n" \
27048  " /* accès à la base */\n" \
27049  " iCodRet = givEcritDonEtab(tcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, \"\", \"\", \"\", &iDebut);\n" \
27050  " }\n" \
27051  " }\n" \
27052  "\n" \
27053  " if (0 == iDebut)\n" \
27054  " {\n" \
27055  " strcpy(buf_pos, \"</sgipro>\");\n" \
27056  " lg_ecr = strlen(buf_pos);\n" \
27057  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
27058  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
27059  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
27060  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
27061  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBalise);\n" \
27062  " buf_pos = buf_pos + lg_write;\n" \
27063  "\n" \
27064  " if ('\\0' != GIVBuffXML[0])\n" \
27065  " {\n" \
27066  " /* Ecriture dans le fichier de sortie sans changement de format */\n" \
27067  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27068  " }\n" \
27069  " }\n" \
27070  " }\n" \
27071  " else if (0 == strcmp(\"DV\", tcType))\n" \
27072  " {\n" \
27073  " /* DV ou Marques par an8 pour CVIV */\n" \
27074  " *buf_pos_in = buf_pos;\n" \
27075  " iDebut = 1;\n" \
27076  "\n" \
27077  " for (j = 0; j < giviNbProfEtab; j++)\n" \
27078  " {\n" \
27079  " if ('V' == givrListProfEtab[j].cIndic)\n" \
27080  " {\n" \
27081  " /* accès à un fichier */\n" \
27082  " iCodRet = givEcritSgiProED(tcType, tcBalise, &buf_pos, *buf_pos_in, doc, givrListProfEtab[j].tcAn8, \"\", \"\", &iDebut);\n" \
27083  "\n" \
27084  " if ('\\0' != GIVBuffXML[0])\n" \
27085  " {\n" \
27086  " /* Ecriture dans le fichier de sortie sans changement de format */\n" \
27087  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27088  " }\n" \
27089  " }\n" \
27090  " }\n" \
27091  "\n" \
27092  " if (0 == iDebut)\n" \
27093  " {\n" \
27094  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBalise);\n" \
27095  " buf_pos = buf_pos + lg_write;\n" \
27096  "\n" \
27097  " if ('\\0' != GIVBuffXML[0])\n" \
27098  " {\n" \
27099  " /* Ecriture dans le fichier de sortie sans changement de format */\n" \
27100  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27101  " }\n" \
27102  " }\n" \
27103  " }\n" \
27104  " else if (0 == strcmp(\"GS\", tcType))\n" \
27105  " {\n" \
27106  " *buf_pos_in = buf_pos;\n" \
27107  " iDebut = 1;\n" \
27108  " i = 0;\n" \
27109  " /* liste d'opposition fichier GS complet */\n" \
27110  " iCodRet = givOppositionURLGratuite((doc + i)->value.a_classer.etab, givcR000000);\n" \
27111  "\n" \
27112  " /* écriture SGIPRO */\n" \
27113  " if ((int4)GIV::GIXCodeKO == iCodRet)\n" \
27114  " {\n" \
27115  " if (0 == strcmp(tcType, obj))\n" \
27116  " {\n" \
27117  " /* accès à un fichier */\n" \
27118  " iCodRet = givEcritSgiProED(tcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, \"\", \"\", \"\", &iDebut);\n" \
27119  " }\n" \
27120  " else\n" \
27121  " {\n" \
27122  " /* accès à la base */\n" \
27123  " iCodRet = givEcritDonEtab(tcType, tcBalise, &buf_pos, *buf_pos_in, doc + i, \"\", \"\", \"\", &iDebut);\n" \
27124  " }\n" \
27125  " }\n" \
27126  "\n" \
27127  " if (0 == iDebut)\n" \
27128  " {\n" \
27129  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBalise);\n" \
27130  " buf_pos = buf_pos + lg_write;\n" \
27131  " }\n" \
27132  " }\n" \
27133  " else if (0 == strcmp(\"AD\", tcType))\n" \
27134  " {\n" \
27135  " /* données additionnelles annotées */\n" \
27136  " iCodRet = givEcritDonAdd(tcType, &buf_pos, doc, indice);\n" \
27137  " }\n" \
27138  "\n" \
27139  " if ('\\0' != GIVBuffXML[0])\n" \
27140  " {\n" \
27141  " /* Ecriture dans le fichier de sortie */\n" \
27142  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27143  " }\n" \
27144  "\n" \
27145  " *buf_pos_in = buf_pos;\n" \
27146  " GWTTrace(GWT_NIV_FONCT, (\"Sortie Ecriture Contenu ED par établissement\\n\"));\n" \
27147  " return (iCodRet);\n" \
27148  "}\n" \
27149  "\n" \
27150  "/*----Fonction----------------------------------------------------------------*/\n" \
27151  "/* */\n" \
27152  "/* Fonction : givEcritImages () */\n" \
27153  "/* */\n" \
27154  "/* But : ecrit le corps PHOTOS des PVI */\n" \
27155  "/* */\n" \
27156  "/* */\n" \
27157  "/* Entree(s) : un buffer, Structure Document */\n" \
27158  "/* */\n" \
27159  "/* Sortie(s) : OK ou KO */\n" \
27160  "/* */\n" \
27161  "/* Portable : Transparent */\n" \
27162  "/* */\n" \
27163  "/*----------------------------------------------------------------------------*/\n" \
27164  "static int4 givEcritImages(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 iRef)\n" \
27165  "{\n" \
27166  " int4 lg_write;\n" \
27167  " char* buf_pos;\n" \
27168  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27169  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27170  " int4 lg_tmp;\n" \
27171  " char cNomFichier[128] = \"\"; /* Pathname des fichiers utilises */\n" \
27172  " char cStr[4096 + 1] = \"\";\n" \
27173  " char* pcDebut, *pcFin;\n" \
27174  " int4 i;\n" \
27175  " struct timeval sTemps1;\n" \
27176  " struct timeval sTemps2;\n" \
27177  " long double iDureeAppelMilliSec;\n" \
27178  " /* Initialisation des variables locales */\n" \
27179  " (void)memset((void*)cNomFichier, 0x00, (size_t)sizeof(cNomFichier));\n" \
27180  "\n" \
27181  " /* ouverture du fichier des mouvements CD2G */\n" \
27182  " /* constitution du nom du fichier */\n" \
27183  " if (0 == strlen(doc->value.numero_client))\n" \
27184  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s.xml\", givtcRepSgiPro, \"IP\", doc->value.objets_pub.micro[iRef].id[4], doc->value.objets_pub.micro[iRef].id[5],\n" \
27185  " doc->value.objets_pub.micro[iRef].id[6], doc->value.objets_pub.micro[iRef].id[7], doc->value.objets_pub.micro[iRef].id[8], doc->value.objets_pub.micro[iRef].stype,\n" \
27186  " doc->value.objets_pub.micro[iRef].id);\n" \
27187  " else\n" \
27188  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s.xml\", givtcRepSgiPro, \"IP\", doc->value.numero_client[0], doc->value.numero_client[1], doc->value.numero_client[2], doc->value.numero_client[3],\n" \
27189  " doc->value.numero_client[4], \"IP\", doc->value.objets_pub.micro[iRef].id);\n" \
27190  "\n" \
27191  " GWTTrace(GWT_NIV_FONCT, (\"Nom fichier PHOTOS <%s>\\n\", cNomFichier));\n" \
27192  " /* temps d'accès SGIPro */\n" \
27193  " /* gettimeofday(&sTemps1, NULL); */\n" \
27194  " /* Ouverture fichier SGIPRO */\n" \
27195  " GIVfDescFicPhotos = fopen(cNomFichier, \"r\");\n" \
27196  "\n" \
27197  " if (NULL == GIVfDescFicPhotos)\n" \
27198  " {\n" \
27199  " /* Echec ouverture fichier mouvements => erreur */\n" \
27200  " GWTTrace(GWT_NIV_FONCT, (\"Erreur FOPEN fichier Photos : [ERR=%02Xh, PTH=%s]\\n\", errno, cNomFichier));\n" \
27201  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
27202  " return (iCodRet);\n" \
27203  " }\n" \
27204  "\n" \
27205  " /* Initialisation pointeur */\n" \
27206  " buf_pos = *buf_pos_in;\n" \
27207  " pcDebut = 0;\n" \
27208  " pcFin = 0;\n" \
27209  "\n" \
27210  " do\n" \
27211  " {\n" \
27212  " /* lecture de la ligne suivante */\n" \
27213  " (void)fgets(cStr, sizeof(cStr), GIVfDescFicPhotos);\n" \
27214  "\n" \
27215  " /* suppression des espaces en début de ligne */\n" \
27216  " for (i = 0; ((isblank((unsigned char)cStr[i])) && (i < strlen(cStr))); i++)\n" \
27217  " ;\n" \
27218  "\n" \
27219  " /* ligne de liste associée à SGIPRO */\n" \
27220  " if ((0 != pcDebut) && (0 == pcFin))\n" \
27221  " {\n" \
27222  " pcFin = strstr(&cStr[i], \"</photos>\");\n" \
27223  "\n" \
27224  " if (0 == pcFin)\n" \
27225  " {\n" \
27226  " if (sizeof(GIVBuffXML) < (strlen(GIVBuffXML) + strlen(cStr)))\n" \
27227  " {\n" \
27228  " /* Ecriture dans le fichier de sortie */\n" \
27229  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27230  " }\n" \
27231  " }\n" \
27232  "\n" \
27233  " /* écriture de ligne courante entre début et fin */\n" \
27234  " strcpy(buf_pos, &cStr[i]);\n" \
27235  " buf_pos = buf_pos + strlen(buf_pos);\n" \
27236  " }\n" \
27237  "\n" \
27238  " if (0 == pcDebut)\n" \
27239  " {\n" \
27240  " pcDebut = strstr(&cStr[i], \"<photos>\");\n" \
27241  "\n" \
27242  " if (0 != pcDebut)\n" \
27243  " {\n" \
27244  " strcpy(buf_pos, &cStr[i]);\n" \
27245  " buf_pos = buf_pos + strlen(buf_pos);\n" \
27246  " pcFin = 0;\n" \
27247  " }\n" \
27248  " }\n" \
27249  "\n" \
27250  " if ((0 != pcDebut) && (0 == pcFin))\n" \
27251  " {\n" \
27252  " pcFin = strstr(&cStr[i], \"</photos>\");\n" \
27253  "\n" \
27254  " if (0 != pcFin)\n" \
27255  " {\n" \
27256  " strcpy(buf_pos, &cStr[i]);\n" \
27257  " buf_pos = buf_pos + strlen(buf_pos);\n" \
27258  " pcDebut = 0;\n" \
27259  " }\n" \
27260  " }\n" \
27261  " }\n" \
27262  " while (0 == feof(GIVfDescFicPhotos));\n" \
27263  "\n" \
27264  " /* Fermeture fichier SGIPRO */\n" \
27265  " iIntRet = fclose(GIVfDescFicPhotos);\n" \
27266  "#if 0\n" \
27267  " /* temps d'accès SGIPro */\n" \
27268  " gettimeofday(&sTemps2, NULL);\n" \
27269  " iDureeAppelMilliSec = (double)((double)((sTemps2.tv_sec - sTemps1.tv_sec) * 1000000) +\n" \
27270  " (double)(sTemps2.tv_usec - sTemps1.tv_usec));\n" \
27271  " GIViCumulDureeIncl += iDureeAppelMilliSec;\n" \
27272  " GIViCumulNbreIncl ++;\n" \
27273  " GWTTrace(GWT_NIV_FONCT,\n" \
27274  " (\"Durée inclusion %s : %0.Lf microsecondes, Cumul : %0.Lf, %0.Lf microsecondes\\n\", givtcRepSgiPro,\n" \
27275  " iDureeAppelMilliSec, GIViCumulNbreIncl, GIViCumulDureeIncl));\n" \
27276  " GWTTrace(GWT_NIV_FONCT, (\"Debut %d, %d\\n\", sTemps1.tv_sec, sTemps1.tv_usec));\n" \
27277  " GWTTrace(GWT_NIV_FONCT, (\"Fin %d, %d\\n\", sTemps2.tv_sec, sTemps2.tv_usec));\n" \
27278  "#endif\n" \
27279  " iCodRet = GIV::GWCCodeOK;\n" \
27280  " *buf_pos_in = buf_pos;\n" \
27281  " return (iCodRet);\n" \
27282  "}\n" \
27283  "\n" \
27284  "/*----Fonction----------------------------------------------------------------*/\n" \
27285  "/* */\n" \
27286  "/* Fonction : givEcritSgiPro () */\n" \
27287  "/* */\n" \
27288  "/* But : ecrit le corps SGIPRO des contenus */\n" \
27289  "/* */\n" \
27290  "/* */\n" \
27291  "/* Entree(s) : un buffer, Structure Document */\n" \
27292  "/* */\n" \
27293  "/* Sortie(s) : OK ou KO */\n" \
27294  "/* */\n" \
27295  "/* Portable : Transparent */\n" \
27296  "/* */\n" \
27297  "/*----------------------------------------------------------------------------*/\n" \
27298  "static int4 givEcritSgiPro(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 iDoc, int4 iRef, int4 indice, char* pcBalise, int4 iBalise)\n" \
27299  "{\n" \
27300  " int4 lg_write;\n" \
27301  " char* buf_pos;\n" \
27302  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27303  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27304  " int4 lg_tmp;\n" \
27305  " char cNomFichier[128] = \"\"; /* Pathname des fichiers utilises */\n" \
27306  " char cStr[4096 + 1] = \"\";\n" \
27307  " char tcBalise[50 + 1];\n" \
27308  " char tcBaliseFin[50 + 1];\n" \
27309  " char* pcDebut, *pcFin;\n" \
27310  " int4 i, k, iNbCRC;\n" \
27311  " /* Initialisation des variables locales */\n" \
27312  " (void)memset((void*)cNomFichier, 0x00, (size_t)sizeof(cNomFichier));\n" \
27313  "\n" \
27314  " /* constitution du nom du fichier */\n" \
27315  " if (0 != (doc + iDoc)->value.objets_pub.micro[iRef].iCVI)\n" \
27316  " {\n" \
27317  " /* CVI vintage ou nouvel objet */\n" \
27318  " if (0 == strlen((doc + iDoc)->value.numero_client))\n" \
27319  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s.xml\", givtcRepSgiPro, (doc + iDoc)->value.objets_pub.micro[iRef].stypcvi, (doc + iDoc)->value.objets_pub.micro[iRef].id[4],\n" \
27320  " (doc + iDoc)->value.objets_pub.micro[iRef].id[5], (doc + iDoc)->value.objets_pub.micro[iRef].id[6], (doc + iDoc)->value.objets_pub.micro[iRef].id[7], (doc + iDoc)->value.objets_pub.micro[iRef].id[8],\n" \
27321  " (doc + iDoc)->value.objets_pub.micro[iRef].stypcvi, (doc + iDoc)->value.objets_pub.micro[iRef].id);\n" \
27322  " else\n" \
27323  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s.xml\", givtcRepSgiPro, (doc + iDoc)->value.objets_pub.micro[iRef].stypcvi, (doc + iDoc)->value.numero_client[0],\n" \
27324  " (doc + iDoc)->value.numero_client[1], (doc + iDoc)->value.numero_client[2], (doc + iDoc)->value.numero_client[3], (doc + iDoc)->value.numero_client[4],\n" \
27325  " (doc + iDoc)->value.objets_pub.micro[iRef].stypcvi, (doc + iDoc)->value.objets_pub.micro[iRef].id);\n" \
27326  " }\n" \
27327  " else if (0 == strlen((doc + iDoc)->value.numero_client))\n" \
27328  " {\n" \
27329  " if (' ' == (doc + iDoc)->value.objets_pub.micro[iRef].stype[0])\n" \
27330  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s.xml\", givtcRepSgiPro, &(doc + iDoc)->value.objets_pub.micro[iRef].stype[1], (doc + iDoc)->value.objets_pub.micro[iRef].id[4],\n" \
27331  " (doc + iDoc)->value.objets_pub.micro[iRef].id[5], (doc + iDoc)->value.objets_pub.micro[iRef].id[6], (doc + iDoc)->value.objets_pub.micro[iRef].id[7], (doc + iDoc)->value.objets_pub.micro[iRef].id[8],\n" \
27332  " &(doc + iDoc)->value.objets_pub.micro[iRef].stype[1], (doc + iDoc)->value.objets_pub.micro[iRef].id);\n" \
27333  " else\n" \
27334  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s.xml\", givtcRepSgiPro, (doc + iDoc)->value.objets_pub.micro[iRef].stype, (doc + iDoc)->value.objets_pub.micro[iRef].id[4],\n" \
27335  " (doc + iDoc)->value.objets_pub.micro[iRef].id[5], (doc + iDoc)->value.objets_pub.micro[iRef].id[6], (doc + iDoc)->value.objets_pub.micro[iRef].id[7], (doc + iDoc)->value.objets_pub.micro[iRef].id[8],\n" \
27336  " (doc + iDoc)->value.objets_pub.micro[iRef].stype, (doc + iDoc)->value.objets_pub.micro[iRef].id);\n" \
27337  " }\n" \
27338  " else\n" \
27339  " {\n" \
27340  " if (' ' == (doc + iDoc)->value.objets_pub.micro[iRef].stype[0])\n" \
27341  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s.xml\", givtcRepSgiPro, &(doc + iDoc)->value.objets_pub.micro[iRef].stype[1], (doc + iDoc)->value.numero_client[0],\n" \
27342  " (doc + iDoc)->value.numero_client[1], (doc + iDoc)->value.numero_client[2], (doc + iDoc)->value.numero_client[3], (doc + iDoc)->value.numero_client[4],\n" \
27343  " &(doc + iDoc)->value.objets_pub.micro[iRef].stype[1], (doc + iDoc)->value.objets_pub.micro[iRef].id);\n" \
27344  " else\n" \
27345  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s.xml\", givtcRepSgiPro, (doc + iDoc)->value.objets_pub.micro[iRef].stype, (doc + iDoc)->value.numero_client[0],\n" \
27346  " (doc + iDoc)->value.numero_client[1], (doc + iDoc)->value.numero_client[2], (doc + iDoc)->value.numero_client[3], (doc + iDoc)->value.numero_client[4],\n" \
27347  " (doc + iDoc)->value.objets_pub.micro[iRef].stype, (doc + iDoc)->value.objets_pub.micro[iRef].id);\n" \
27348  " }\n" \
27349  "\n" \
27350  " GWTTrace(GWT_NIV_FONCT, (\"Nom fichier SGIPRO <%s>\\n\", cNomFichier));\n" \
27351  " /* Ouverture fichier SGIPRO */\n" \
27352  " GIVfDescFicSGIPRO = fopen(cNomFichier, \"r\");\n" \
27353  "\n" \
27354  " if (NULL == GIVfDescFicSGIPRO)\n" \
27355  " {\n" \
27356  " /* Echec ouverture fichier mouvements => erreur */\n" \
27357  " GWTTrace(GWT_NIV_FONCT, (\"Erreur FOPEN fichier SGIPRO : [ERR=%02Xh, PTH=%s]\\n\", errno, cNomFichier));\n" \
27358  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
27359  " return (iCodRet);\n" \
27360  " }\n" \
27361  "\n" \
27362  " /* Initialisation pointeur */\n" \
27363  " buf_pos = *buf_pos_in;\n" \
27364  " pcDebut = 0;\n" \
27365  " pcFin = 0;\n" \
27366  "\n" \
27367  " do\n" \
27368  " {\n" \
27369  " /* lecture de la ligne suivante */\n" \
27370  " (void)fgets(cStr, sizeof(cStr), GIVfDescFicSGIPRO);\n" \
27371  "\n" \
27372  " /* ligne de liste associée à SGIPRO */\n" \
27373  " if ((0 != pcDebut) && (0 == pcFin))\n" \
27374  " {\n" \
27375  " pcFin = strstr(cStr, \"</sgipro>\");\n" \
27376  "\n" \
27377  " if (0 == pcFin)\n" \
27378  " {\n" \
27379  " if (sizeof(GIVBuffXML) < (strlen(GIVBuffXML) + strlen(cStr)))\n" \
27380  " {\n" \
27381  " /* Ecriture dans le fichier de sortie */\n" \
27382  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27383  " }\n" \
27384  "\n" \
27385  " /* écriture de ligne courante entre début et fin */\n" \
27386  " iNbCRC = giviNbCRC;\n" \
27387  " iCodRet = givAnalyseCRC((doc + iDoc)->value.objets_pub.micro[iRef].stype, iRef, (doc + iDoc), cStr, tcBalise, tcBaliseFin);\n" \
27388  "\n" \
27389  " if ((0 == strcmp(\"SC\", (doc + iDoc)->value.objets_pub.micro[iRef].stype)) && (0 != strcmp(\"SR\", (doc + iDoc)->value.objets_pub.micro[iRef].sstype)) && (0 != strstr(cStr, \"</pvi>\")))\n" \
27390  " {\n" \
27391  " /* pour PVI inclusion du fichier \"IP\" */\n" \
27392  " iIntRet = givEcritImages(&buf_pos, (doc + iDoc), iRef);\n" \
27393  " }\n" \
27394  "\n" \
27395  " lg_write = giv_ecrit_noeud_simple(buf_pos, tcBalise);\n" \
27396  " buf_pos = buf_pos + lg_write;\n" \
27397  " strcpy(buf_pos, cStr);\n" \
27398  " buf_pos = buf_pos + strlen(buf_pos);\n" \
27399  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBaliseFin);\n" \
27400  " }\n" \
27401  "\n" \
27402  " buf_pos = buf_pos + strlen(buf_pos);\n" \
27403  " }\n" \
27404  "\n" \
27405  " if (0 == pcDebut)\n" \
27406  " {\n" \
27407  " pcDebut = strstr(cStr, \"<sgipro>\");\n" \
27408  "\n" \
27409  " if (0 != pcDebut)\n" \
27410  " {\n" \
27411  " buf_pos = buf_pos + strlen(buf_pos);\n" \
27412  " pcFin = 0;\n" \
27413  "\n" \
27414  " if (buf_pos == *buf_pos_in)\n" \
27415  " {\n" \
27416  " if (((int4)GIV::GIXCodeKO == iBalise) || ((int4)GIV::GIXCodeRIEN == iBalise))\n" \
27417  " {\n" \
27418  " lg_write = giv_ecrit_noeud_simple(buf_pos, pcBalise);\n" \
27419  " buf_pos = buf_pos + lg_write;\n" \
27420  " }\n" \
27421  "\n" \
27422  " iIntRet = giv_ecrit_objet_pub(&buf_pos, (doc + iDoc), 0, iRef, \"objetcontenu\");\n" \
27423  " }\n" \
27424  " }\n" \
27425  " }\n" \
27426  "\n" \
27427  " if ((0 != pcDebut) && (0 == pcFin))\n" \
27428  " {\n" \
27429  " pcFin = strstr(cStr, \"</sgipro>\");\n" \
27430  "\n" \
27431  " if (0 != pcFin)\n" \
27432  " pcDebut = 0;\n" \
27433  " }\n" \
27434  " }\n" \
27435  " while (0 == feof(GIVfDescFicSGIPRO));\n" \
27436  "\n" \
27437  " /* Fermeture fichier SGIPRO */\n" \
27438  " iIntRet = fclose(GIVfDescFicSGIPRO);\n" \
27439  " iCodRet = GIV::GWCCodeKO;\n" \
27440  "\n" \
27441  " if (buf_pos != *buf_pos_in)\n" \
27442  " iCodRet = GIV::GWCCodeOK;\n" \
27443  "\n" \
27444  " *buf_pos_in = buf_pos;\n" \
27445  " return (iCodRet);\n" \
27446  "}\n" \
27447  "\n" \
27448  "/*----Fonction----------------------------------------------------------------*/\n" \
27449  "/* */\n" \
27450  "/* Fonction : givEcritSgiProPart () */\n" \
27451  "/* */\n" \
27452  "/* But : ecrit le corps SGIPRO des contenus des partenaires */\n" \
27453  "/* */\n" \
27454  "/* */\n" \
27455  "/* Entree(s) : un buffer, Structure Document */\n" \
27456  "/* */\n" \
27457  "/* Sortie(s) : OK ou KO */\n" \
27458  "/* */\n" \
27459  "/* Portable : Transparent */\n" \
27460  "/* */\n" \
27461  "/*----------------------------------------------------------------------------*/\n" \
27462  "static int4 givEcritSgiProPart(char** buf_pos_in, GYBrDOCUMENTEpj* doc, char* pcEtab, char* pcRef, char* pcType, char* pcBalise, int4* piDeb)\n" \
27463  "{\n" \
27464  " int4 lg_write;\n" \
27465  " char* buf_pos;\n" \
27466  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27467  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27468  " char cNomFichier[128] = \"\"; /* Pathname des fichiers utilises */\n" \
27469  " char cStr[4096 + 1] = \"\";\n" \
27470  " char cStr1[4098 + 1] = \"\";\n" \
27471  " char cNomBalise[100];\n" \
27472  " char cNomBalises[100];\n" \
27473  " char tcBalise[50 + 1];\n" \
27474  " char tcBaliseFin[50 + 1];\n" \
27475  " int4 iDebut;\n" \
27476  " int4 j, jRef;\n" \
27477  " char tcType[3];\n" \
27478  " /* Initialisation des variables locales */\n" \
27479  " (void)memset((void*)cNomFichier, 0x00, (size_t)sizeof(cNomFichier));\n" \
27480  " /* mutalisation */\n" \
27481  " strcpy(tcType, pcType);\n" \
27482  " strcpy(cNomBalises, pcBalise);\n" \
27483  " sprintf(cNomBalise, \"elempart_%s\", &pcRef[strlen(pcRef) - 4]);\n" \
27484  " /* ouverture du fichier des mouvements CD2G */\n" \
27485  " /* constitution du nom du fichier */\n" \
27486  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s.xml\", givtcRepSgiPro, tcType, pcRef[0], pcRef[1], pcRef[2], pcRef[3], pcRef[4], pcRef);\n" \
27487  " GWTTrace(GWT_NIV_FONCT, (\"Nom fichier SGIPRO <%s>\\n\", cNomFichier));\n" \
27488  " /* Ouverture fichier SGIPRO */\n" \
27489  " GIVfDescFicSGIPRO = fopen(cNomFichier, \"r\");\n" \
27490  "\n" \
27491  " if (NULL == GIVfDescFicSGIPRO)\n" \
27492  " {\n" \
27493  " /* Echec ouverture fichier mouvements => erreur */\n" \
27494  " GWTTrace(GWT_NIV_FONCT, (\"Fichier SGIPRO Partenaire absent: [ERR=%02Xh, PTH=%s]\\n\", errno, cNomFichier));\n" \
27495  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
27496  " return (iCodRet);\n" \
27497  " }\n" \
27498  "\n" \
27499  " /* Initialisation pointeur */\n" \
27500  " buf_pos = *buf_pos_in;\n" \
27501  " iDebut = (int4) - 1;\n" \
27502  "\n" \
27503  " do\n" \
27504  " {\n" \
27505  " /* lecture de la ligne suivante */\n" \
27506  " (void)fgets(cStr, sizeof(cStr), GIVfDescFicSGIPRO);\n" \
27507  " GWTTrace(GWT_NIV_FONCT, (\"Fichier Part <%s>\\n\", cStr));\n" \
27508  "\n" \
27509  " /* ligne de liste associée à SGIPRO */\n" \
27510  " if ((1 == iDebut) && (0 != strcmp(cStr1, cStr)))\n" \
27511  " {\n" \
27512  " if (sizeof(GIVBuffXML) < (strlen(GIVBuffXML) + strlen(cStr)))\n" \
27513  " {\n" \
27514  " /* Ecriture dans le fichier de sortie */\n" \
27515  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27516  " }\n" \
27517  "\n" \
27518  " iCodRet = givAnalyseCRC(tcType, -1, doc, cStr, tcBalise, tcBaliseFin);\n" \
27519  " lg_write = giv_ecrit_noeud_simple(buf_pos, tcBalise);\n" \
27520  " buf_pos = buf_pos + lg_write;\n" \
27521  " strcpy(buf_pos, cStr);\n" \
27522  " buf_pos = buf_pos + strlen(buf_pos);\n" \
27523  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBaliseFin);\n" \
27524  " buf_pos = buf_pos + lg_write;\n" \
27525  " }\n" \
27526  " else if ((0 == iDebut) && (cStr[0] == '<'))\n" \
27527  " {\n" \
27528  " iDebut = 1;\n" \
27529  " (void)strcpy(&cStr1[2], &cStr[1]);\n" \
27530  " cStr1[0] = '<';\n" \
27531  " cStr1[1] = '/';\n" \
27532  " lg_write = giv_ecrit_noeud_simple(buf_pos, pcBalise);\n" \
27533  " buf_pos = buf_pos + lg_write;\n" \
27534  "\n" \
27535  " for (j = 0; j < doc->value.a_classer.iNbPart; j++)\n" \
27536  " {\n" \
27537  " if (0 == strcmp(pcRef, doc->value.a_classer.trpart[j].rpart))\n" \
27538  " jRef = j;\n" \
27539  " }\n" \
27540  "\n" \
27541  " lg_write = giv_ecrit_element_partenaire(cNomBalise, buf_pos, pcRef, pcEtab, doc->value.a_classer.trpart[jRef].parent);\n" \
27542  " buf_pos = buf_pos + lg_write;\n" \
27543  " }\n" \
27544  " else if (((int4) - 1 == iDebut) && (0 == memcmp(\"]>\", cStr, 2)))\n" \
27545  " iDebut = 0;\n" \
27546  " }\n" \
27547  " while (0 == feof(GIVfDescFicSGIPRO));\n" \
27548  "\n" \
27549  " /* Fermeture fichier SGIPRO */\n" \
27550  " iIntRet = fclose(GIVfDescFicSGIPRO);\n" \
27551  "\n" \
27552  " if (buf_pos != *buf_pos_in)\n" \
27553  " {\n" \
27554  " lg_write = giv_ecrit_fin_noeud(&buf_pos, cNomBalise);\n" \
27555  " buf_pos = buf_pos + lg_write;\n" \
27556  " lg_write = giv_ecrit_fin_noeud(&buf_pos, pcBalise);\n" \
27557  " buf_pos = buf_pos + lg_write;\n" \
27558  " }\n" \
27559  "\n" \
27560  " *buf_pos_in = buf_pos;\n" \
27561  " iCodRet = GIV::GWCCodeOK;\n" \
27562  " return (iCodRet);\n" \
27563  "}\n" \
27564  "\n" \
27565  "/*----Fonction----------------------------------------------------------------*/\n" \
27566  "/* */\n" \
27567  "/* Fonction : givEcritSgiProPartEtab () */\n" \
27568  "/* */\n" \
27569  "/* But : ecrit le corps SGIPRO des contenus des partenaires */\n" \
27570  "/* par établissement */\n" \
27571  "/* */\n" \
27572  "/* Entree(s) : un buffer, Structure Document */\n" \
27573  "/* */\n" \
27574  "/* Sortie(s) : OK ou KO */\n" \
27575  "/* */\n" \
27576  "/* Portable : Transparent */\n" \
27577  "/* */\n" \
27578  "/*----------------------------------------------------------------------------*/\n" \
27579  "static int4 givEcritSgiProPartEtab(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice, char* pcEtab, char* pcRef, char* pcType, char* pcBalise, int4* piDeb)\n" \
27580  "{\n" \
27581  " int4 lg_write, lg_ecr = 0;\n" \
27582  " char* buf_pos;\n" \
27583  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27584  " int4 iCrcRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27585  " int4 iRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27586  " char cNomBalise[100];\n" \
27587  " char cNomBalises[100];\n" \
27588  " char tcType[3];\n" \
27589  " char* pt_debut_element, *pt_debut_liste;\n" \
27590  " char* pt_fin_element, *pt_fin_liste;\n" \
27591  " GYBrIapartT rIapart;\n" \
27592  " int4 i, j, iRef, jRef;\n" \
27593  " int4 iRgParent, iNbParent;\n" \
27594  " /* Initialisation des variables locales */\n" \
27595  " strcpy(tcType, pcType);\n" \
27596  " strcpy(cNomBalises, pcBalise);\n" \
27597  " strcat(cNomBalises, \"s\");\n" \
27598  " sprintf(cNomBalise, \"elempart_%s\", &pcRef[strlen(pcRef) - 4]);\n" \
27599  " /* référence de partenaire */\n" \
27600  " (void)strcpy(rIapart.acOriPart, &pcRef[strlen(pcRef) - 4]);\n" \
27601  " memcpy(rIapart.acRefPart, pcRef, strlen(pcRef) - 4);\n" \
27602  " rIapart.acRefPart[strlen(pcRef) - 4] = '\\0';\n" \
27603  " rIapart.acParentRefPart[0] = '\\0';\n" \
27604  " rIapart.acTypeRefPart[0] = '\\0';\n" \
27605  " iRef = 0;\n" \
27606  " jRef = 0;\n" \
27607  "\n" \
27608  " for (i = 0; i < indice; i++)\n" \
27609  " {\n" \
27610  " for (j = 0; j < (doc + i)->value.a_classer.iNbPart; j++)\n" \
27611  " {\n" \
27612  " if (0 == strcmp(pcRef, (doc + i)->value.a_classer.trpart[j].rpart))\n" \
27613  " {\n" \
27614  " strcpy(rIapart.acParentRefPart, (doc + i)->value.a_classer.trpart[j].parent);\n" \
27615  " strcpy(rIapart.acTypeRefPart, (doc + i)->value.a_classer.trpart[j].typepart);\n" \
27616  " iRgParent = (doc + i)->value.a_classer.trpart[j].iRgParent;\n" \
27617  " iNbParent = (doc + i)->value.a_classer.trpart[j].iNbParent;\n" \
27618  " iRef = i;\n" \
27619  " jRef = j;\n" \
27620  " }\n" \
27621  " }\n" \
27622  " }\n" \
27623  "\n" \
27624  " buf_pos = *buf_pos_in;\n" \
27625  " /* lecture donnée \"complément\" */\n" \
27626  " iRet = givLecturePartEtab(&rIapart, GIV::GIXCodeOK);\n" \
27627  "\n" \
27628  " if ((0 != strlen(GIVBuffInter)) && (NULL == strstr(GIVBuffInter, \"<complement/>\")))\n" \
27629  " {\n" \
27630  " if (1 == *piDeb)\n" \
27631  " *piDeb = 0;\n" \
27632  "\n" \
27633  " lg_write = giv_ecrit_noeud_simple(buf_pos, pcBalise);\n" \
27634  " buf_pos = buf_pos + lg_write;\n" \
27635  " lg_write = giv_ecrit_element_partenaire(cNomBalise, buf_pos, pcRef, pcEtab, rIapart.acParentRefPart);\n" \
27636  " buf_pos = buf_pos + lg_write;\n" \
27637  " /* analyse CRC <normale> */\n" \
27638  " pt_fin_liste = GIVBuffInter;\n" \
27639  " pt_debut_liste = strstr(pt_fin_liste, \"<complement>\");\n" \
27640  " pt_debut_liste += strlen(\"<complement>\");\n" \
27641  " pt_debut_liste++;\n" \
27642  " pt_fin_liste = strstr(pt_debut_liste, \"</complement>\");\n" \
27643  " *pt_fin_liste = '\\0';\n" \
27644  " iCodRet = givAnalyseObjetXML(pcType, doc, pt_debut_liste, &buf_pos);\n" \
27645  " lg_ecr = strlen(GIVBuffXML);\n" \
27646  " /* Ecriture dans le fichier de sortie */\n" \
27647  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27648  "\n" \
27649  " if (0 == strcmp(giv_PJDC, rIapart.acOriPart))\n" \
27650  " {\n" \
27651  " /* analyse parent pour c et pr */\n" \
27652  " if (giv_cPJDC == rIapart.acTypeRefPart[0])\n" \
27653  " {\n" \
27654  " GWTTrace(GWT_NIV_FONCT, (\"Cle annexe <%s> \\n\", (doc + iRef)->value.a_classer.trpart[jRef].clenav));\n" \
27655  " lg_write = giv_ecrit_noeud_attr(buf_pos, \"equipe\", (doc + iRef)->value.a_classer.trpart[jRef].clenav);\n" \
27656  " buf_pos = buf_pos + lg_write;\n" \
27657  " }\n" \
27658  "\n" \
27659  " if ((giv_prPJDC == rIapart.acTypeRefPart[0]) || (giv_cPJDC == rIapart.acTypeRefPart[0]))\n" \
27660  " {\n" \
27661  " for (i = iRgParent; i < (iRgParent + iNbParent); i++)\n" \
27662  " {\n" \
27663  " if ((giv_cPJDC == givtrPart[i].acTypeRefPart[0]) || (giv_prPJDC == givtrPart[i].acTypeRefPart[0]))\n" \
27664  " {\n" \
27665  " lg_write = GIV_ecrit_element_parent(&buf_pos, &givtrPart[i]);\n" \
27666  " buf_pos = buf_pos + lg_write;\n" \
27667  " }\n" \
27668  " }\n" \
27669  " }\n" \
27670  "\n" \
27671  " if (giv_cPJDC == rIapart.acTypeRefPart[0])\n" \
27672  " {\n" \
27673  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"equipe\");\n" \
27674  " buf_pos = buf_pos + lg_write;\n" \
27675  " }\n" \
27676  "\n" \
27677  " /* analyse parent pour o, sv, c et pr */\n" \
27678  " iCodRet = (int4)giv_ecrit_navigation(&buf_pos, iRgParent, iNbParent, doc->value.a_classer.trpart[giviRefPJDC].typepart[0], &rIapart, (doc + iRef)->value.a_classer.trpart[jRef].clenav);\n" \
27679  " }\n" \
27680  "\n" \
27681  " /* Ecriture dans le fichier de sortie */\n" \
27682  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27683  " }\n" \
27684  "\n" \
27685  " /* lecture donnée \"photos\" */\n" \
27686  " if ((int4)GIV::GWCCodeOK == iRet)\n" \
27687  " {\n" \
27688  " iRet = givLecturePartEtab(&rIapart, GIV::GIXCodeKO);\n" \
27689  "\n" \
27690  " if ((0 != strlen(GIVBuffInter)) && (NULL == strstr(GIVBuffInter, \"<photos/>\")))\n" \
27691  " {\n" \
27692  " if (1 == *piDeb)\n" \
27693  " *piDeb = 0;\n" \
27694  "\n" \
27695  " if (0 == lg_ecr)\n" \
27696  " {\n" \
27697  " lg_write = giv_ecrit_noeud_simple(buf_pos, pcBalise);\n" \
27698  " buf_pos = buf_pos + lg_write;\n" \
27699  " lg_write = giv_ecrit_element_partenaire(cNomBalise, buf_pos, pcRef, pcEtab, rIapart.acParentRefPart);\n" \
27700  " buf_pos = buf_pos + lg_write;\n" \
27701  " }\n" \
27702  "\n" \
27703  " lg_ecr = strlen(GIVBuffInter);\n" \
27704  " strcpy(buf_pos, GIVBuffInter);\n" \
27705  " buf_pos = (buf_pos + lg_ecr);\n" \
27706  " }\n" \
27707  "\n" \
27708  " if (0 != lg_ecr)\n" \
27709  " {\n" \
27710  " lg_write = giv_ecrit_fin_noeud(&buf_pos, cNomBalise);\n" \
27711  " buf_pos = buf_pos + lg_write;\n" \
27712  " lg_write = giv_ecrit_fin_noeud(&buf_pos, pcBalise);\n" \
27713  " buf_pos = buf_pos + lg_write;\n" \
27714  " /* Ecriture dans le fichier de sortie */\n" \
27715  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27716  " }\n" \
27717  " }\n" \
27718  "\n" \
27719  " *buf_pos_in = buf_pos;\n" \
27720  " iCodRet = GIV::GWCCodeOK;\n" \
27721  " return (iCodRet);\n" \
27722  "}\n" \
27723  "\n" \
27724  "/*----Fonction----------------------------------------------------------------*/\n" \
27725  "/* */\n" \
27726  "/* Fonction : givEcritSgiProBOC () */\n" \
27727  "/* */\n" \
27728  "/* But : ecrit le corps SGIPRO des contenus BOC Contributifs */\n" \
27729  "/* */\n" \
27730  "/* */\n" \
27731  "/* Entree(s) : un buffer, Structure Document */\n" \
27732  "/* */\n" \
27733  "/* Sortie(s) : OK ou KO */\n" \
27734  "/* */\n" \
27735  "/* Portable : Transparent */\n" \
27736  "/* */\n" \
27737  "/*----------------------------------------------------------------------------*/\n" \
27738  "static int4 givEcritSgiProBOC(char** buf_pos_in, GYBrDOCUMENTEpj* doc, int4 indice, char* pcRef, char* pcType, char* pcBalise)\n" \
27739  "{\n" \
27740  " int4 lg_write;\n" \
27741  " char* buf_pos;\n" \
27742  " char* deb_pos;\n" \
27743  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27744  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27745  " char cNomFichier[128] = \"\"; /* Pathname des fichiers utilises */\n" \
27746  " char cStr[4096 + 1] = \"\";\n" \
27747  " char cStr1[4098 + 1] = \"\";\n" \
27748  " char tcBalise[50 + 1];\n" \
27749  " char tcBaliseFin[50 + 1];\n" \
27750  " int4 iDebut, i, j;\n" \
27751  " char* pt_debut_element;\n" \
27752  " char* pt_fin_element;\n" \
27753  " char tcRub[GYBPaprofLgCodan9 + 1];\n" \
27754  " /* Initialisation des variables locales */\n" \
27755  " (void)memset((void*)cNomFichier, 0x00, (size_t)sizeof(cNomFichier));\n" \
27756  " /* ouverture du fichier des mouvements CD2G */\n" \
27757  " /* constitution du nom du fichier */\n" \
27758  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s.xml\", givtcRepSgiPro, pcType, pcRef[0], pcRef[1], pcRef[2], pcRef[3], pcRef[4], pcRef);\n" \
27759  " GWTTrace(GWT_NIV_FONCT, (\"Nom fichier SGIPRO BOC <%s>\\n\", cNomFichier));\n" \
27760  " /* Ouverture fichier SGIPRO */\n" \
27761  " GIVfDescFicSGIPRO = fopen(cNomFichier, \"r\");\n" \
27762  "\n" \
27763  " if (NULL == GIVfDescFicSGIPRO)\n" \
27764  " {\n" \
27765  " /* Echec ouverture fichier mouvements => erreur */\n" \
27766  " GWTTrace(GWT_NIV_FONCT, (\"Fichier SGIPRO BOC absent: [ERR=%02Xh, PTH=%s]\\n\", errno, cNomFichier));\n" \
27767  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
27768  " /* contenu absent pour l'epj */\n" \
27769  " return (iCodRet);\n" \
27770  " }\n" \
27771  "\n" \
27772  " /* Initialisation pointeur */\n" \
27773  " buf_pos = *buf_pos_in;\n" \
27774  " deb_pos = buf_pos;\n" \
27775  " iDebut = (int4) - 2;\n" \
27776  " /* lecture de la ligne */\n" \
27777  " (void)fgets(cStr, sizeof(cStr), GIVfDescFicSGIPRO);\n" \
27778  "\n" \
27779  " while (0 == feof(GIVfDescFicSGIPRO))\n" \
27780  " {\n" \
27781  " GWTTrace(GWT_NIV_FONCT, (\"Fichier BOC %d,<%s>\\n\", iDebut, cStr));\n" \
27782  "\n" \
27783  " /* ligne de liste associée à SGIPRO */\n" \
27784  " if ((2 == iDebut) && (NULL == strstr(cStr, cStr1)))\n" \
27785  " {\n" \
27786  " if (NULL != strstr(cStr, \"rubrique\"))\n" \
27787  " {\n" \
27788  " pt_debut_element = strchr(&cStr[1], '>');\n" \
27789  " pt_fin_element = strchr(&cStr[1], '<');\n" \
27790  "\n" \
27791  " if (NULL == pt_fin_element || NULL == pt_debut_element)\n" \
27792  " {\n" \
27793  " /* pas de rubrique commune */\n" \
27794  " iDebut = 1;\n" \
27795  " buf_pos = deb_pos;\n" \
27796  " (void)strcpy(&cStr1[1], \"fragment\");\n" \
27797  " cStr1[0] = '<';\n" \
27798  " continue;\n" \
27799  " }\n" \
27800  "\n" \
27801  " pt_debut_element++;\n" \
27802  "\n" \
27803  " if (GYBPaprofLgCodan9 != (pt_fin_element - pt_debut_element))\n" \
27804  " {\n" \
27805  " iDebut = 1;\n" \
27806  " buf_pos = deb_pos;\n" \
27807  " (void)strcpy(&cStr1[1], \"fragment\");\n" \
27808  " cStr1[0] = '<';\n" \
27809  " continue;\n" \
27810  " }\n" \
27811  "\n" \
27812  " memcpy(tcRub, pt_debut_element, (pt_fin_element - pt_debut_element));\n" \
27813  " tcRub[(pt_fin_element - pt_debut_element)] = '\\0';\n" \
27814  " GWTTrace(GWT_NIV_FONCT, (\"Rub BOC <%s>\\n\", tcRub));\n" \
27815  "\n" \
27816  " for (i = 0; i < (givrListParu.iNbrTot); i++)\n" \
27817  " {\n" \
27818  " j = givrListParu.trEltRangList[i];\n" \
27819  "\n" \
27820  " if (0 == strcmp(givrListParu.trEltList[j].rub, tcRub))\n" \
27821  " break;\n" \
27822  " }\n" \
27823  "\n" \
27824  " if (i == givrListParu.iNbrTot)\n" \
27825  " {\n" \
27826  " /* pas de rubrique commune */\n" \
27827  " iDebut = 1;\n" \
27828  " buf_pos = deb_pos;\n" \
27829  " (void)strcpy(&cStr1[1], \"fragment\");\n" \
27830  " cStr1[0] = '<';\n" \
27831  " continue;\n" \
27832  " }\n" \
27833  " }\n" \
27834  "\n" \
27835  " iCodRet = givAnalyseCRC(pcType, -1, doc, cStr, tcBalise, tcBaliseFin);\n" \
27836  " lg_write = giv_ecrit_noeud_simple(buf_pos, tcBalise);\n" \
27837  " buf_pos = buf_pos + lg_write;\n" \
27838  " strcpy(buf_pos, cStr);\n" \
27839  " buf_pos = buf_pos + strlen(buf_pos);\n" \
27840  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBaliseFin);\n" \
27841  " buf_pos = buf_pos + lg_write;\n" \
27842  " }\n" \
27843  " else if ((2 == iDebut) && (NULL != strstr(cStr, cStr1)))\n" \
27844  " {\n" \
27845  " iDebut = 1;\n" \
27846  " (void)strcpy(&cStr1[1], \"fragment\");\n" \
27847  " cStr1[0] = '<';\n" \
27848  " strcpy(buf_pos, cStr);\n" \
27849  " buf_pos = buf_pos + strlen(cStr);\n" \
27850  " /* Ecriture dans le fichier de sortie */\n" \
27851  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
27852  " deb_pos = buf_pos;\n" \
27853  " }\n" \
27854  " else if ((1 == iDebut) && (NULL != strstr(cStr, cStr1)))\n" \
27855  " {\n" \
27856  " iDebut = 2;\n" \
27857  " (void)strcpy(&cStr1[2], \"fragment\");\n" \
27858  " cStr1[0] = '<';\n" \
27859  " cStr1[1] = '/';\n" \
27860  " strcpy(buf_pos, cStr);\n" \
27861  " buf_pos = buf_pos + strlen(cStr);\n" \
27862  " }\n" \
27863  " else if (0 == iDebut)\n" \
27864  " {\n" \
27865  " iCodRet = givAnalyseCRC(pcType, -1, doc, cStr, tcBalise, tcBaliseFin);\n" \
27866  " lg_write = giv_ecrit_noeud_simple(buf_pos, tcBalise);\n" \
27867  " buf_pos = buf_pos + lg_write;\n" \
27868  " strcpy(buf_pos, cStr);\n" \
27869  " buf_pos = buf_pos + strlen(buf_pos);\n" \
27870  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBaliseFin);\n" \
27871  " buf_pos = buf_pos + lg_write;\n" \
27872  "\n" \
27873  " if ((NULL == strstr(cStr, cStr1)) && (NULL == strstr(cStr, \"annonceur\")))\n" \
27874  " deb_pos = buf_pos - strlen(cStr);\n" \
27875  " else if (NULL != strstr(cStr, \"annonceur\"))\n" \
27876  " deb_pos = buf_pos;\n" \
27877  " else\n" \
27878  " {\n" \
27879  " iDebut = 2;\n" \
27880  " (void)strcpy(&cStr1[2], \"fragment\");\n" \
27881  " cStr1[0] = '<';\n" \
27882  " cStr1[1] = '/';\n" \
27883  " }\n" \
27884  " }\n" \
27885  " else if ((-1 == iDebut) && (cStr[0] == '<'))\n" \
27886  " {\n" \
27887  " iDebut = 0;\n" \
27888  " (void)strcpy(&cStr1[1], \"fragment\");\n" \
27889  " cStr1[0] = '<';\n" \
27890  " lg_write = giv_ecrit_noeud_simple(buf_pos, pcBalise);\n" \
27891  " buf_pos = buf_pos + lg_write;\n" \
27892  " deb_pos = buf_pos;\n" \
27893  " }\n" \
27894  " else if (((int4) - 2 == iDebut) && (0 == memcmp(\"]>\", cStr, 2)))\n" \
27895  " iDebut = -1;\n" \
27896  "\n" \
27897  " /* lecture de la ligne suivante */\n" \
27898  " (void)fgets(cStr, sizeof(cStr), GIVfDescFicSGIPRO);\n" \
27899  " }\n" \
27900  "\n" \
27901  " /* Fermeture fichier SGIPRO */\n" \
27902  " iIntRet = fclose(GIVfDescFicSGIPRO);\n" \
27903  "\n" \
27904  " if ((-1 != iDebut) && (-2 != iDebut))\n" \
27905  " {\n" \
27906  " if (0 == iDebut)\n" \
27907  " {\n" \
27908  " buf_pos = deb_pos;\n" \
27909  " /* contenu absent pour l'epj */\n" \
27910  " }\n" \
27911  "\n" \
27912  " lg_write = giv_ecrit_fin_noeud(&buf_pos, pcBalise);\n" \
27913  " buf_pos = buf_pos + lg_write;\n" \
27914  " }\n" \
27915  "\n" \
27916  " *buf_pos_in = buf_pos;\n" \
27917  " iCodRet = GIV::GWCCodeOK;\n" \
27918  " return (iCodRet);\n" \
27919  "}\n" \
27920  "\n" \
27921  "/*----Fonction----------------------------------------------------------------*/\n" \
27922  "/* */\n" \
27923  "/* Fonction : givEcritSgiProED () */\n" \
27924  "/* */\n" \
27925  "/* But : ecrit le corps SGIPRO des contenus */\n" \
27926  "/* */\n" \
27927  "/* */\n" \
27928  "/* Entree(s) : un buffer, Structure Document */\n" \
27929  "/* */\n" \
27930  "/* Sortie(s) : OK ou KO */\n" \
27931  "/* */\n" \
27932  "/* Portable : Transparent */\n" \
27933  "/* */\n" \
27934  "/*----------------------------------------------------------------------------*/\n" \
27935  "static int4 givEcritSgiProED(char* acobj, char* pcBalise, char** buf_pos_in, char* buf_pos_ref, GYBrDOCUMENTEpj* doc, char* tcRub, char* tcDep, char* tcSource, int4* piDeb)\n" \
27936  "{\n" \
27937  " int4 lg_write, lg_ecr = 0;\n" \
27938  " char* buf_pos;\n" \
27939  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27940  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
27941  " int4 lg_tmp;\n" \
27942  " int4 iBLEPJProf = 0;\n" \
27943  " char cNomFichier[128] = \"\";\n" \
27944  " char obj[3 + 1] = \"\";\n" \
27945  " char tcBalise[50 + 1];\n" \
27946  " char tcBaliseFin[50 + 1];\n" \
27947  " /* Pathname des fichiers utilises */\n" \
27948  " char cStr[4096 + 1] = \"\";\n" \
27949  " char cStrRef[100 + 1] = \"\";\n" \
27950  " char cStrFinRef[100 + 1] = \"\";\n" \
27951  " char cStrSupp[100 + 1] = \"\";\n" \
27952  " char cStrFinSupp[100 + 1] = \"\";\n" \
27953  " char* pcDebut, *pcFin;\n" \
27954  " /* Initialisation des variables locales */\n" \
27955  " (void)memset((void*)cNomFichier, 0x00, (size_t)sizeof(cNomFichier));\n" \
27956  " /* type d'objet */\n" \
27957  " strcpy(obj, acobj);\n" \
27958  "\n" \
27959  " /* ouverture du fichier des mouvements CD2G */\n" \
27960  " /* constitution du nom du fichier */\n" \
27961  " if ((0 == strcmp(givtcRapED, \"ETAB\")) && (0 != strcmp(\"EG\", obj)) && (0 != strcmp(\"EM\", obj)) && (0 != strcmp(\"DV\", obj)) && (0 != strcmp(\"MV\", obj)) && (0 != strcmp(\"GS\", obj))\n" \
27962  " && (0 != strcmp(\"BB\", obj)) && (0 != strcmp(\"AD\", obj)))\n" \
27963  " {\n" \
27964  " if (0 == strlen(doc->value.a_classer.etab))\n" \
27965  " {\n" \
27966  " GWTTrace(GWT_NIV_FONCT, (\"Pas Nom fichier SGIPRO %s\\n\", obj));\n" \
27967  " return (iCodRet);\n" \
27968  " }\n" \
27969  "\n" \
27970  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s_%s.xml\", givtcRepSgiPro, obj, doc->value.a_classer.etab[0], doc->value.a_classer.etab[1], doc->value.a_classer.etab[2],\n" \
27971  " doc->value.a_classer.etab[3], doc->value.a_classer.etab[4], obj, doc->value.a_classer.etab, tcRub);\n" \
27972  " }\n" \
27973  " else if ((0 == strcmp(givtcRapED, \"ETAB\")) && (0 == strcmp(\"EG\", obj) || 0 == strcmp(\"EM\", obj) || 0 == strcmp(\"DV\", obj) || 0 == strcmp(\"MV\", obj) || 0 == strcmp(\"GS\", obj)\n" \
27974  " || 0 == strcmp(\"BB\", obj)))\n" \
27975  " {\n" \
27976  " if (0 == strlen(doc->value.a_classer.etab))\n" \
27977  " {\n" \
27978  " GWTTrace(GWT_NIV_FONCT, (\"Pas Nom fichier SGIPRO %s\\n\", obj));\n" \
27979  " return (iCodRet);\n" \
27980  " }\n" \
27981  "\n" \
27982  " if ((0 != strlen(tcRub)) && (((0 == strcmp(\"DV\", obj))) || (0 == strcmp(\"EM\", obj))))\n" \
27983  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s_%s.xml\", givtcRepSgiPro, obj, doc->value.a_classer.etab[0], doc->value.a_classer.etab[1], doc->value.a_classer.etab[2],\n" \
27984  " doc->value.a_classer.etab[3], doc->value.a_classer.etab[4], obj, doc->value.a_classer.etab, tcRub);\n" \
27985  " else\n" \
27986  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s.xml\", givtcRepSgiPro, obj, doc->value.a_classer.etab[0], doc->value.a_classer.etab[1], doc->value.a_classer.etab[2],\n" \
27987  " doc->value.a_classer.etab[3], doc->value.a_classer.etab[4], obj, doc->value.a_classer.etab);\n" \
27988  " }\n" \
27989  " else if ((0 == strcmp(givtcRapED, \"ETAB\")) && (0 == strcmp(\"AD\", obj)))\n" \
27990  " {\n" \
27991  " if (0 == strlen(doc->value.a_classer.etab))\n" \
27992  " {\n" \
27993  " GWTTrace(GWT_NIV_FONCT, (\"Pas Nom fichier SGIPRO %s\\n\", obj));\n" \
27994  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
27995  " return (iCodRet);\n" \
27996  " }\n" \
27997  "\n" \
27998  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c%c%c/%s_%s_%s.xml\", givtcRepSgiPro, obj, doc->value.a_classer.etab[0], doc->value.a_classer.etab[1], doc->value.a_classer.etab[2],\n" \
27999  " doc->value.a_classer.etab[3], doc->value.a_classer.etab[4], obj, doc->value.a_classer.etab, tcSource);\n" \
28000  " }\n" \
28001  " else if (0 == strcmp(givtcRapED, \"OUI\"))\n" \
28002  " (void)sprintf(&cNomFichier[0], \"%s/%s/%c%c/%c/%s_%s_%s_%s_%s.xml\", givtcRepSgiPro, obj, tcDep[0], tcDep[1], tcDep[2], obj, tcDep, tcSource, doc->value.inscription[0].val_num, tcRub);\n" \
28003  "\n" \
28004  " /* balise de référence à rechercher */\n" \
28005  " strcpy(cStrRef, \"<sgipro>\");\n" \
28006  " strcpy(cStrFinRef, \"</sgipro>\");\n" \
28007  " strcpy(cStrSupp, \"<lstMarques>\");\n" \
28008  " strcpy(cStrFinSupp, \"</lstMarques>\");\n" \
28009  " GWTTrace(GWT_NIV_FONCT, (\"Nom fichier SGIPRO %s <%s>\\n\", obj, cNomFichier));\n" \
28010  " /* Ouverture fichier SGIPRO */\n" \
28011  " GIVfDescFicSGIPRO = fopen(cNomFichier, \"r\");\n" \
28012  "\n" \
28013  " if (NULL == GIVfDescFicSGIPRO)\n" \
28014  " {\n" \
28015  " /* Echec ouverture fichier mouvements => erreur */\n" \
28016  " GWTTrace(GWT_NIV_FONCT, (\"Erreur FOPEN fichier SGIPRO ED : [ERR=%02Xh, PTH=%s]\\n\", errno, cNomFichier));\n" \
28017  " iCodRet = (int4)GIV::GIXCodeKO;\n" \
28018  " return (iCodRet);\n" \
28019  " }\n" \
28020  "\n" \
28021  " /* Initialisation pointeur */\n" \
28022  " buf_pos = *buf_pos_in;\n" \
28023  " pcDebut = 0;\n" \
28024  " pcFin = 0;\n" \
28025  "\n" \
28026  " do\n" \
28027  " {\n" \
28028  " /* lecture de la ligne suivante */\n" \
28029  " (void)fgets(cStr, sizeof(cStr), GIVfDescFicSGIPRO);\n" \
28030  "\n" \
28031  " /* ligne de liste associée à SGIPRO */\n" \
28032  " if ((0 != pcDebut) && (0 == pcFin))\n" \
28033  " {\n" \
28034  " pcFin = strstr(cStr, cStrFinRef);\n" \
28035  "\n" \
28036  " if (0 == pcFin)\n" \
28037  " {\n" \
28038  " if (sizeof(GIVBuffXML) < (strlen(GIVBuffXML) + strlen(cStr)))\n" \
28039  " {\n" \
28040  " /* Ecriture dans le fichier de sortie */\n" \
28041  " iCodRet = (int4)giv_sortie(&buf_pos, GIVfDescFicBloc);\n" \
28042  " }\n" \
28043  "\n" \
28044  " if ((0 == strcmp(\"EG\", obj)) && (0 != strstr(cStr, \"<urlSite>\")) && (0 != strlen(doc->value.objets_pub.libUrlSite)))\n" \
28045  " {\n" \
28046  " strcpy(&cStr[0], \"<urlSite>\");\n" \
28047  " strcat(cStr, doc->value.objets_pub.libUrlSite);\n" \
28048  " strcat(cStr, \"</urlSite>\");\n" \
28049  " lg_ecr = strlen(cStr);\n" \
28050  " *(cStr + lg_ecr) = SEPARE_LIGNE;\n" \
28051  " *(cStr + (lg_ecr + 1)) = LINE_FEED;\n" \
28052  " *(cStr + (lg_ecr + 2)) = '\\0';\n" \
28053  " (void)strcpy(doc->value.objets_pub.libUrlSite, \"\");\n" \
28054  " }\n" \
28055  "\n" \
28056  " /* écriture de ligne courante entre début et fin */\n" \
28057  " iCodRet = givAnalyseCRC(obj, -1, doc, cStr, tcBalise, tcBaliseFin);\n" \
28058  "\n" \
28059  " if ((int4)GIV::GIXCodeOK == iCodRet)\n" \
28060  " {\n" \
28061  " /* fichier global non inclus */\n" \
28062  " buf_pos = *buf_pos_in;\n" \
28063  " *buf_pos = '\\0';\n" \
28064  " break;\n" \
28065  " }\n" \
28066  "\n" \
28067  " if (0 == strcmp(\"EG\", obj))\n" \
28068  " {\n" \
28069  " if ((0 != strstr(cStr, cStrSupp)) && (1 == doc->value.a_classer.iBLEPJProf))\n" \
28070  " {\n" \
28071  " /* Black-listage de balise */\n" \
28072  " iBLEPJProf = 1;\n" \
28073  " }\n" \
28074  "\n" \
28075  " if (0 == iBLEPJProf)\n" \
28076  " {\n" \
28077  " lg_write = giv_ecrit_noeud_simple(buf_pos, tcBalise);\n" \
28078  " buf_pos = buf_pos + lg_write;\n" \
28079  " strcpy(buf_pos, cStr);\n" \
28080  " buf_pos = buf_pos + strlen(buf_pos);\n" \
28081  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBaliseFin);\n" \
28082  " }\n" \
28083  "\n" \
28084  " if ((0 != strstr(cStr, cStrFinSupp)) && (1 == doc->value.a_classer.iBLEPJProf))\n" \
28085  " {\n" \
28086  " /* Fin du Black-listage de balise */\n" \
28087  " iBLEPJProf = 0;\n" \
28088  " }\n" \
28089  " }\n" \
28090  " else\n" \
28091  " {\n" \
28092  " lg_write = giv_ecrit_noeud_simple(buf_pos, tcBalise);\n" \
28093  " buf_pos = buf_pos + lg_write;\n" \
28094  " strcpy(buf_pos, cStr);\n" \
28095  " buf_pos = buf_pos + strlen(buf_pos);\n" \
28096  " lg_write = giv_ecrit_fin_noeud(&buf_pos, tcBaliseFin);\n" \
28097  " }\n" \
28098  " }\n" \
28099  " else if ((0 == strcmp(\"AD\", obj)) && (0 != pcFin))\n" \
28100  " {\n" \
28101  " strcpy(buf_pos, \"</Search_\");\n" \
28102  " strcat(buf_pos, tcSource);\n" \
28103  " strcat(buf_pos, \">\");\n" \
28104  " lg_ecr = strlen(buf_pos);\n" \
28105  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
28106  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
28107  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
28108  " }\n" \
28109  "\n" \
28110  " buf_pos = buf_pos + strlen(buf_pos);\n" \
28111  " }\n" \
28112  "\n" \
28113  " if (0 == pcDebut)\n" \
28114  " {\n" \
28115  " pcDebut = strstr(cStr, cStrRef);\n" \
28116  "\n" \
28117  " if (0 != pcDebut)\n" \
28118  " {\n" \
28119  " buf_pos = buf_pos + strlen(buf_pos);\n" \
28120  " pcFin = 0;\n" \
28121  "\n" \
28122  " if ((buf_pos == buf_pos_ref) && (1 == *piDeb) && ((0 == strcmp(\"GS\", obj)) || (0 == strcmp(\"AD\", obj)) || (0 == strcmp(\"DV\", obj))))\n" \
28123  " {\n" \
28124  " lg_write = giv_ecrit_noeud_simple(buf_pos, pcBalise);\n" \
28125  " buf_pos = buf_pos + lg_write;\n" \
28126  " *piDeb = 0;\n" \
28127  " }\n" \
28128  " else if ((buf_pos == buf_pos_ref) && (1 == *piDeb))\n" \
28129  " {\n" \
28130  " lg_write = giv_ecrit_noeud_simple(buf_pos, pcBalise);\n" \
28131  " buf_pos = buf_pos + lg_write;\n" \
28132  " strcpy(buf_pos, cStrRef);\n" \
28133  " lg_ecr = strlen(buf_pos);\n" \
28134  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
28135  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
28136  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
28137  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
28138  " *piDeb = 0;\n" \
28139  " }\n" \
28140  "\n" \
28141  " if (0 == strcmp(\"AD\", obj))\n" \
28142  " {\n" \
28143  " strcpy(buf_pos, \"<Search_\");\n" \
28144  " strcat(buf_pos, tcSource);\n" \
28145  " strcat(buf_pos, \" etablissement=\\\"\\\" id=\\\"\");\n" \
28146  " strcat(buf_pos, doc->value.a_classer.etab);\n" \
28147  " strcat(buf_pos, \"\\\">\");\n" \
28148  " lg_ecr = strlen(buf_pos);\n" \
28149  " *(buf_pos + lg_ecr) = SEPARE_LIGNE;\n" \
28150  " *(buf_pos + (lg_ecr + 1)) = LINE_FEED;\n" \
28151  " *(buf_pos + (lg_ecr + 2)) = '\\0';\n" \
28152  " buf_pos = (buf_pos + lg_ecr + 2);\n" \
28153  " }\n" \
28154  " }\n" \
28155  " }\n" \
28156  "\n" \
28157  " if ((0 != pcDebut) && (0 == pcFin))\n" \
28158  " {\n" \
28159  " pcFin = strstr(cStr, cStrFinRef);\n" \
28160  "\n" \
28161  " if (0 != pcFin)\n" \
28162  " pcDebut = 0;\n" \
28163  " }\n" \
28164  " }\n" \
28165  " while (0 == feof(GIVfDescFicSGIPRO));\n" \
28166  "\n" \
28167  " *buf_pos_in = buf_pos;\n" \
28168  " /* Fermeture fichier SGIPRO */\n" \
28169  " iIntRet = fclose(GIVfDescFicSGIPRO);\n" \
28170  " iCodRet = GIV::GWCCodeOK;\n" \
28171  " return (iCodRet);\n" \
28172  "}\n" \
28173  "\n" \
28174  "/*----Fonction----------------------------------------------------------------*/\n" \
28175  "/* */\n" \
28176  "/* Fonction : GIVMiseEnFormeMvtSuppEpj () */\n" \
28177  "/* */\n" \
28178  "/* But : Remplissage du buffer d'ecriture avec uniquement les champs */\n" \
28179  "/* renseignes (variables indicatrices nulles) pour suppression */\n" \
28180  "/* de blocs */\n" \
28181  "/* Entree(s) : */\n" \
28182  "/* */\n" \
28183  "/* Sortie(s) : */\n" \
28184  "/* */\n" \
28185  "/* Portable : Surement portable */\n" \
28186  "/* */\n" \
28187  "/*----------------------------------------------------------------------------*/\n" \
28188  "/*---------------------------------Historique----------------------------------\n" \
28189  " *\n" \
28190  " * Création : Oct/03/2006 (mb)\n" \
28191  " *\n" \
28192  " * Modification (MM/JJ/AAAA - xx) :\n" \
28193  " *\n" \
28194  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
28195  "\n" \
28196  "int4 GIVMiseEnFormeMvtSuppEpj(char* blocid, char* pcCodope, int4 dernier_ligne, int4 aiMaxBloc, int4 aiMaxBlocEcrit)\n" \
28197  "\n" \
28198  "{\n" \
28199  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
28200  " int4 iIntRet = GIV::GWCCodeOK;\n" \
28201  " EXEC SQL\n" \
28202  " begin declare\n" \
28203  " section;\n" \
28204  " char cBlocid[26 + 1];\n" \
28205  " char tcRequete[1024];\n" \
28206  " char cDepart[GYBIeinscLgDeppar + 1];\n" \
28207  " EXEC SQL\n" \
28208  " end declare\n" \
28209  " section;\n" \
28210  " GYBrParam_erreurT vErreurSQL; /* Traitement des erreurs SQL */\n" \
28211  " char* buf_pos;\n" \
28212  " int4 lg_write;\n" \
28213  " int4 lg_a_ecrire;\n" \
28214  " char nom_bloc_sup[50 + 1];\n" \
28215  " char chaine_id[7 + 1]; /* Numero qui s'incremente */\n" \
28216  " char nom_test[50 + 1]; /* Nom du test */\n" \
28217  " char cChemin[128] = \"\"; /* Pathname des fichiers utilises */\n" \
28218  " char cNomFichier[128] = \"\"; /* Pathname des fichiers utilises */\n" \
28219  " char cNomFichier1[256] = \"\"; /* Pathname des fichiers utilises */\n" \
28220  " int4 lg_ecrit_entete = 0;\n" \
28221  " char cEntete_xml[100] = \"<?xml version=\\\"1.0\\\" encoding=\\\"ISO-8859-1\\\" ?>\";\n" \
28222  " char conf[50];\n" \
28223  " char* pcVersion = NULL;\n" \
28224  "\n" \
28225  " if ((0 == strcmp(givRecreerCD, GIXcNomIntf)) && (0 != strcmp(GIXcValUrg, GWZUrgent)) && (0 == dernier_ligne))\n" \
28226  " {\n" \
28227  " /* pas de suppression en sortie en création */\n" \
28228  " return (iCodRet);\n" \
28229  " }\n" \
28230  "\n" \
28231  " GWTTrace(GWT_NIV_FONCT, (\"dernier = %d\\n\", dernier_ligne));\n" \
28232  " /* pas de commit */\n" \
28233  " GIViCommit = (int4)GIV::GIXCodeKO;\n" \
28234  "\n" \
28235  " if (obtention_iden == 0)\n" \
28236  " givInitConfGXX();\n" \
28237  "\n" \
28238  " strcpy(nom_bloc_ref, blocid);\n" \
28239  "\n" \
28240  " if (0 == dernier_ligne)\n" \
28241  " {\n" \
28242  " /* Pointeur sur debut du buffer */\n" \
28243  " buf_pos = GIVBuffXML;\n" \
28244  " /* écriture d'un bloc */\n" \
28245  " strcpy(nom_bloc_sup, blocid);\n" \
28246  " lg_write = giv_ecrit_noeud_simple(buf_pos, \"OPERATION\");\n" \
28247  " buf_pos = buf_pos + lg_write;\n" \
28248  " lg_write = giv_ecrit_balise(buf_pos, \"delete\", \"TYPE_OPERATION\");\n" \
28249  " buf_pos = buf_pos + lg_write;\n" \
28250  " lg_write = giv_ecrit_balise(buf_pos, nom_bloc_sup, \"NAME\");\n" \
28251  " buf_pos = buf_pos + lg_write;\n" \
28252  " lg_write = giv_ecrit_fin_noeud(&buf_pos, \"OPERATION\");\n" \
28253  " buf_pos = buf_pos + lg_write;\n" \
28254  " /* Calcul du numero d'identifiant parution_id */\n" \
28255  " num_id = num_id + 1;\n" \
28256  " iIntRet = giv_fichier_sortie(&buf_pos, &GIVfDescFicMCD);\n" \
28257  "\n" \
28258  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
28259  " {\n" \
28260  " /* Erreur sur ecriture fin document */\n" \
28261  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur sur ecriture fin document dans partie_3 ...\\n\"));\n" \
28262  " iCodRet = (int4)GIV::GWCCodeKO;\n" \
28263  " }\n" \
28264  "\n" \
28265  " pcVersion = strchr(pcVersionInsFour[0], (char)'.');\n" \
28266  " pcVersion++;\n" \
28267  " /* fermeture du fichier */\n" \
28268  " iIntRet = (int4)giv_fermeture_fichier_sortie(&buf_pos, nom_bloc_sup);\n" \
28269  " GIVBuffXML[0] = '\\0';\n" \
28270  " /* suppressions de lignes du blocid */\n" \
28271  " (void)strcpy(vErreurSQL.acOrdre_sql, \"Suppression anciens blocs GYTtabIeBloc\");\n" \
28272  " (void)strcpy((char*)cDepart, (const char*)GIXcDepartement);\n" \
28273  " (void)strcpy(cBlocid, blocid);\n" \
28274  " GWTTrace(GWT_NIV_FONCT, (\"blocid : %s\\n\", cBlocid));\n" \
28275  " EXEC SQL\n" \
28276  " execute rqtDelIeBloc\n" \
28277  " using\n" \
28278  " :cDepart,\n" \
28279  " :cBlocid;\n" \
28280  " iCodRet = GIVBlocErreur(&vErreurSQL);\n" \
28281  "\n" \
28282  " /* Analyse du code resultat SQL */\n" \
28283  " if (((int4)GIV::GWCCodeOK != iCodRet) && ((int4)GIV::GYBnodata != iCodRet))\n" \
28284  " GWTTrace(GWT_NIV_BIZAR, (\"Erreur : [COD=%d TXT=%s]\\n\", iCodRet, vErreurSQL.acOrdre_sql));\n" \
28285  "\n" \
28286  " if (0 == strcmp(\"OUI\", givtcGeneIeBlocCRC))\n" \
28287  " {\n" \
28288  " /* suppression sur blocid dans GYTtabIeBlocCRC */\n" \
28289  " iIntRet = givDelIeBlocCRC(blocid);\n" \
28290  " }\n" \
28291  " }\n" \
28292  "\n" \
28293  " if ((1 == dernier_ligne) && (NULL == GIVfDescFicMCD) && (0 == obtention_iden))\n" \
28294  " {\n" \
28295  " /* Pointeur sur debut du buffer */\n" \
28296  " buf_pos = GIVBuffXML;\n" \
28297  " GIVBuffXML[0] = '\\0';\n" \
28298  " iIntRet = giv_fichier_sortie(&buf_pos, &GIVfDescFicMCD);\n" \
28299  "\n" \
28300  " if ((int4)GIV::GWCCodeOK != iIntRet)\n" \
28301  " {\n" \
28302  " /* Erreur sur ecriture fin document */\n" \
28303  " GWTTrace(GWT_NIV_GRAVE, (\"Erreur sur ecriture fin document dans partie_3 ...\\n\"));\n" \
28304  " iCodRet = (int4)GIV::GWCCodeKO;\n" \
28305  " }\n" \
28306  " }\n" \
28307  "\n" \
28308  " if ((1 == dernier_ligne) && (NULL != GIVfDescFicMCD))\n" \
28309  " {\n" \
28310  " /* Initialisation pointeur */\n" \
28311  " buf_pos = GIVBuffXML;\n" \
28312  " /* Calcul de la longueur a ecrire */\n" \
28313  " lg_a_ecrire = giv_ecrit_fin_noeud(&buf_pos, \"documents\");\n" \
28314  " /* ecriture de l'enregistrement dans le fichier de sortie */\n" \
28315  " GWTTrace(GWT_NIV_FONCT, (\"Taille du buff a ecrire dans le fic XML : %d\\n\", lg_a_ecrire));\n" \
28316  " GWTTrace(GWT_NIV_FONCT, (\"Buff a ecrire dans le fic XML : %s\\n\", GIVBuffXML));\n" \
28317  " /* Ecriture dans le fichier de sortie */\n" \
28318  " iIntRet = (int4)fwrite(GIVBuffXML, lg_a_ecrire, 1, GIVfDescFicMCD);\n" \
28319  "\n" \
28320  " if (1 != iIntRet)\n" \
28321  " {\n" \
28322  " /* probleme d'écriture de fichier */\n" \
28323  " GWTTrace(GWT_NIV_GRAVE, (\"Probleme d'écriture de fichier EPJ : %d\\n\", iIntRet));\n" \
28324  " iCodRet = GIV::GIXCodeKO;\n" \
28325  " }\n" \
28326  "\n" \
28327  " /* fichier rempli */\n" \
28328  " iIntRet = fclose(GIVfDescFicMCD);\n" \
28329  "\n" \
28330  " if (iIntRet != (int4)GIV::GWCCodeOK)\n" \
28331  " {\n" \
28332  " /* probleme de fermeture de fichier */\n" \
28333  " GWTTrace(GWT_NIV_GRAVE, (\"Probleme de fermeture de fichier EPJ : %d\\n\", iIntRet));\n" \
28334  " iCodRet = GIV::GIXCodeKO;\n" \
28335  " }\n" \
28336  "\n" \
28337  " GIVfDescFicMCD = NULL;\n" \
28338  "\n" \
28339  " if (NULL != GIVfDescFicCFLT)\n" \
28340  " {\n" \
28341  " iIntRet = fclose(GIVfDescFicCFLT);\n" \
28342  "\n" \
28343  " if (iIntRet != (int4)GIV::GWCCodeOK)\n" \
28344  " {\n" \
28345  " /* probleme de fermeture de fichier */\n" \
28346  " GWTTrace(GWT_NIV_GRAVE, (\"Probleme de fermeture de fichier CFLT\"));\n" \
28347  " iCodRet = GIV::GIXCodeKO;\n" \
28348  " }\n" \
28349  " }\n" \
28350  "\n" \
28351  " GIVfDescFicCFLT = NULL;\n" \
28352  " giviClose = (int4)GIV::GIXCodeKO;\n" \
28353  " }\n" \
28354  "\n" \
28355  " /* Pour ne plus recaluler au prochain passage */\n" \
28356  " obtention_iden = 1;\n" \
28357  " /* Sortie de la fonction */\n" \
28358  " return (iCodRet);\n" \
28359  "}\n" \
28360  "\n" \
28361  "/*----Fonction----------------------------------------------------------------*/\n" \
28362  "/* */\n" \
28363  "/* Fonction : GIVMiseEnFormeEPJ () */\n" \
28364  "/* */\n" \
28365  "/* But : Remplissage du buffer d'ecriture avec uniquement les champs */\n" \
28366  "/* renseignes (variables indicatrices nulles) pour création */\n" \
28367  "/* de blocs EPJ */\n" \
28368  "/* Entree(s) : */\n" \
28369  "/* */\n" \
28370  "/* Sortie(s) : */\n" \
28371  "/* */\n" \
28372  "/* Portable : Surement portable */\n" \
28373  "/* */\n" \
28374  "/*----------------------------------------------------------------------------*/\n" \
28375  "/*---------------------------------Historique----------------------------------\n" \
28376  " *\n" \
28377  " * Création :\n" \
28378  " *\n" \
28379  " * Modification (Dec/13/2001 - mb) : différenciation MOG/MOI\n" \
28380  " *\n" \
28381  " * Modification (Jui/20/2006 - mb) : création de plusieurs fichiers de sortie\n" \
28382  " *\n" \
28383  " *---------------------------Fin de l'en-tête fonction------------------------*/\n" \
28384  "\n" \
28385  "int4 GIVMiseEnFormeEPJ(GYBrMouvementsBlocT* prMouvement, char* pcCodope, int4 dernier_ligne)\n" \
28386  "\n" \
28387  "{\n" \
28388  " int4 iCodRet = GIV::GWCCodeOK; /* Code retour de la fonction */\n" \
28389  " int4 iIntRet = GIV::GWCCodeOK; /* Code retour interne */\n" \
28390  " int2 sSaveNogrouI = -1;\n" \
28391  " int2 sSaveNoseloI = -1;\n" \
28392  " int2 sSaveNoselsI = -1;\n" \
28393  " struct timeval sDate;\n" \
28394  " int4 jncompteur;\n" \
28395  " int4 lg_a_ecrire; /* Longueur du contenu de buffer : a ecrire */\n" \
28396  " int4 lg_IG; /* longueur du champ nogrou_courant */\n" \
28397  " int4 i, j, k;\n" \
28398  " int4 iRes, iAcc;\n" \
28399  " char cInscSante;\n" \
28400  " char cPrtSante;\n" \
28401  " GYBrIapartT rPart;\n" \
28402  " char* buf_pos;\n" \
28403  " char cChemin[128] = \"\"; /* Pathname des fichiers utilises */\n" \
28404  " char cNomFichier[128] = \"\"; /* Pathname des fichiers utilises */\n" \
28405  " time_t date;\n" \
28406  " date = time(NULL);\n" \
28407  " /* Pointeur sur debut du buffer */\n" \
28408  " buf_pos = GIVBuffXML;\n" \
28409  " /* pas de bloc écrit */\n" \
28410  " iMaxBlocEcritAvant = (int4) - 1;\n" \
28411  " /* pas de commit */\n" \
28412  " GIViCommit = (int4)GIV::GIXCodeKO;\n" \
28413  " /* écriture bloc dans buffer */\n" \
28414  " giviCodRetEcr = (int4)GIV::GIXCodeOK;\n" \
28415  " /* récupération des paramètres d'appel */\n" \
28416  " /* pour les rendre visibles des sous-programmes sans etre obligé de les repasser à chaque fois */\n" \
28417  " strcpy(cCodope, pcCodope);\n" \
28418  " prMouvement->copyMvtBloc(cNumlot, cNummvt, cNumnat, cNumlo, cNumls);\n" \
28419  " strcpy(cBlocidPrec, prMouvement->acBlocid);\n" \
28420  " /* Initialisation structure du bloc */\n" \
28421  " iCodRet = givInitBlocParution(&doc);\n" \
28422  "\n" \
28423  " if (dernier_ligne == 0)\n" \
28424  " {\n" \
28425  " /* analyse MC */\n" \
28426  " iCodRet = givMefEnsemble(&doc, nb_inscription);\n" \
28427  " memcpy(&(doc2[nb_inscription]), &doc, sizeof(GYBrDOCUMENTEpj));\n" \
28428  " nb_inscription++;\n" \
28429  " }\n" \
28430  " else\n" \
28431  " {\n" \
28432  " /* analyse Etab */\n" \
28433  " iCodRet = GIVLectureTabPeEtab(doc2->value.a_classer.etab);\n" \
28434  "\n" \
28435  " if ((int4)GIV::GIXCodeKO == iCodRet)\n" \
28436  " {\n" \
28437  " for (i = 0; (i < nb_inscription && givcParuSSAdr == doc2[i].value.inscription[0].adresse.parution[givcIndParuAdr]); i++)\n" \
28438  " ;\n" \
28439  "\n" \
28440  " if (nb_inscription == i)\n" \
28441  " memcpy(&doc, &(doc2[0]), sizeof(GYBrDOCUMENTEpj));\n" \
28442  " else\n" \
28443  " memcpy(&doc, &(doc2[i]), sizeof(GYBrDOCUMENTEpj));\n" \
28444  " }\n" \
28445  " else\n" \
28446  " {\n" \
28447  " iCodRet = givMefDonneesParution(&doc, nb_inscription);\n" \
28448  " iCodRet = givMefMoyensTelecom(&doc, nb_inscription);\n" \
28449  " iCodRet = givMefLieuInstallation(&doc, nb_inscription);\n" \
28450  " }\n" \
28451  "\n" \
28452  " /* données de partenaire liées à l'établissement */\n" \
28453  " iIntRet = GIVLectureTabPartEtab(doc2->value.a_classer.etab, givtcCleNav);\n" \
28454  " GWTTrace(GWT_NIV_FONCT, (\"Nb IaPart : %d\\n\", GIViNbTupleIapart));\n" \
28455  "\n" \
28456  " if (0 != GIViNbTupleIapart)\n" \
28457  " {\n" \
28458  " iRes = 0;\n" \
28459  " iAcc = 0;\n" \
28460  "\n" \
28461  " for (i = 0; i < GIViNbTupleIapart; i++)\n" \
28462  " {\n" \
28463  " if(GIVtrPart[i].isPartenaireValide(giv_RESA, givtcFourPart))\n" \
28464  " iRes = 1;\n" \
28465  " else if(GIVtrPart[i].isPartenaireValide(giv_ACCO, givtcFourPart))\n" \
28466  " {\n" \
28467  " iAcc = 1;\n" \
28468  " break;\n" \
28469  " }\n" \
28470  " }\n" \
28471  "\n" \
28472  " /* analyse type d'inscription */\n" \
28473  " cInscSante = givcParuSante;\n" \
28474  "\n" \
28475  " for (i = 0; (i < nb_inscription && giv_orPJDC != doc2[i].value.intitule.parution[0]); i++)\n" \
28476  " ;\n" \
28477  "\n" \
28478  " if (nb_inscription == i)\n" \
28479  " {\n" \
28480  " for (i = 0; (i < nb_inscription && giv_svPJDC != doc2[i].value.intitule.parution[0]); i++)\n" \
28481  " ;\n" \
28482  " }\n" \
28483  "\n" \
28484  " if (nb_inscription == i)\n" \
28485  " {\n" \
28486  " for (i = 0; (i < nb_inscription && giv_cPJDC != doc2[i].value.intitule.parution[0]); i++)\n" \
28487  " ;\n" \
28488  " }\n" \
28489  "\n" \
28490  " if (nb_inscription == i)\n" \
28491  " {\n" \
28492  " for (i = 0; (i < nb_inscription && giv_prPJDC != doc2[i].value.intitule.parution[0]); i++)\n" \
28493  " ;\n" \
28494  " }\n" \
28495  "\n" \
28496  " if (nb_inscription != i)\n" \
28497  " cInscSante = doc2[i].value.intitule.parution[0];\n" \
28498  "\n" \
28499  " /* analyse type de partenaire */\n" \
28500  " cPrtSante = givcParuSante;\n" \
28501  "\n" \
28502  " for (i = 0; (i < GIViNbTupleIapart && GIVtrPart[i].analyseTypePartenaire(giv_orPJDC, giv_PJDC)); i++)\n" \
28503  " ;\n" \
28504  "\n" \
28505  " if (GIViNbTupleIapart == i)\n" \
28506  " {\n" \
28507  " for (i = 0; (i < GIViNbTupleIapart && GIVtrPart[i].analyseTypePartenaire(giv_svPJDC, giv_PJDC)); i++)\n" \
28508  " ;\n" \
28509  " }\n" \
28510  "\n" \
28511  " if (GIViNbTupleIapart == i)\n" \
28512  " {\n" \
28513  " for (i = 0; (i < GIViNbTupleIapart && GIVtrPart[i].analyseTypePartenaire(giv_cPJDC, giv_PJDC)); i++)\n" \
28514  " ;\n" \
28515  " }\n" \
28516  "\n" \
28517  " if (GIViNbTupleIapart == i)\n" \
28518  " {\n" \
28519  " for (i = 0; (i < GIViNbTupleIapart && GIVtrPart[i].analyseTypePartenaire(giv_prPJDC, giv_PJDC)); i++)\n" \
28520  " ;\n" \
28521  " }\n" \
28522  "\n" \
28523  " if (GIViNbTupleIapart != i)\n" \
28524  " cPrtSante = GIVtrPart[i].acTypeRefPart[0];\n" \
28525  "\n" \
28526  " j = doc2->value.a_classer.iNbPart;\n" \
28527  " giviNbIapartPJDC = 0;\n" \
28528  " giviNbTupleIapart = j;\n" \
28529  " strcpy(rPart.acOriPart, \" \");\n" \
28530  "\n" \
28531  " for (i = 0; i < GIViNbTupleIapart; i++)\n" \
28532  " {\n" \
28533  " if ((NULL == strstr(givtcFourPart, GIVtrPart[i].acOriPart)) || ('0' != GIVvInscrip.acIndPart[0]))\n" \
28534  " {\n" \
28535  " if ((1 == iAcc) && GIVtrPart[i].isOriginePartenaires(giv_RESA, giv_EXPD))\n" \
28536  " {\n" \
28537  " GWTTrace(GWT_NIV_FONCT, (\"Part resa/expd non prioritaire : %s, %s\\n\", GIVtrPart[i].acRefPart, doc2->value.a_classer.etab));\n" \
28538  " continue;\n" \
28539  " }\n" \
28540  " else if ((1 == iRes) && (0 == strcmp(GIVtrPart[i].acOriPart, giv_EXPD)))\n" \
28541  " {\n" \
28542  " GWTTrace(GWT_NIV_FONCT, (\"Part expd non prioritaire : %s, %s\\n\", GIVtrPart[i].acRefPart, doc2->value.a_classer.etab));\n" \
28543  " continue;\n" \
28544  " }\n" \
28545  " else if ((0 == strcmp(GIVtrPart[i].acOriPart, rPart.acOriPart)) && (0 != strcmp(GIVtrPart[i].acOriPart, giv_PJDC)))\n" \
28546  " {\n" \
28547  " GWTTrace(GWT_NIV_FONCT, (\"Part expd (hors pjdc) double non prioritaire : %s, %s\\n\", GIVtrPart[i].acRefPart, doc2->value.a_classer.etab));\n" \
28548  " continue;\n" \
28549  " }\n" \
28550  "\n" \
28551  " /* Analyse santé PJDOC */\n" \
28552  " if ((cInscSante != GIVtrPart[i].acTypeRefPart[0]) && (0 == strcmp(GIVtrPart[i].acOriPart, giv_PJDC)) && ((giv_orPJDC == cInscSante) || (giv_cPJDC == cInscSante)))\n" \
28553  " {\n" \
28554  " GWTTrace(GWT_NIV_FONCT, (\"Type santé non retenu : %c, %s, %s, %s\\n\", cInscSante, GIVtrPart[i].acTypeRefPart, GIVtrPart[i].acRefPart, doc2->value.a_classer.etab));\n" \
28555  " continue;\n" \
28556  " }\n" \
28557  "\n" \
28558  " if ((cPrtSante != GIVtrPart[i].acTypeRefPart[0]) && (0 == strcmp(GIVtrPart[i].acOriPart, giv_PJDC)) && (giv_prPJDC == cInscSante))\n" \
28559  " {\n" \
28560  " GWTTrace(GWT_NIV_FONCT, (\"Type santé non retenu : %c, %s, %s, %s\\n\", cInscSante, GIVtrPart[i].acTypeRefPart, GIVtrPart[i].acRefPart, doc2->value.a_classer.etab));\n" \
28561  " continue;\n" \
28562  " }\n" \
28563  "\n" \
28564  " if (((cPrtSante != GIVtrPart[i].acTypeRefPart[0]) || (giv_orPJDC != cPrtSante && giv_svPJDC != cPrtSante)) && (0 == strcmp(GIVtrPart[i].acOriPart, giv_PJDC)) && (giv_svPJDC == cInscSante))\n" \
28565  " {\n" \
28566  " GWTTrace(GWT_NIV_FONCT, (\"Type santé non retenu : %c, %s, %s, %s\\n\", cInscSante, GIVtrPart[i].acTypeRefPart, GIVtrPart[i].acRefPart, doc2->value.a_classer.etab));\n" \
28567  " continue;\n" \
28568  " }\n" \
28569  "\n" \
28570  " doc2->value.a_classer.trpart[j].iForPJDC = GIV::GIXCodeKO;\n" \
28571  " strcpy(doc2->value.a_classer.trpart[j].rpart, GIVtrPart[i].acRefPart);\n" \
28572  " strcat(doc2->value.a_classer.trpart[j].rpart, GIVtrPart[i].acOriPart);\n" \
28573  " strcpy(doc2->value.a_classer.trpart[j].typepart, GIVtrPart[i].acTypeRefPart);\n" \
28574  " strcpy(doc2->value.a_classer.trpart[j].parent, GIVtrPart[i].acParentRefPart);\n" \
28575  " strcpy(doc2->value.a_classer.trpart[j].idmed, GIVtrPart[i].acIdMed);\n" \
28576  " strcpy(doc2->value.a_classer.trpart[j].isdoc, GIVtrPart[i].acIsDoc);\n" \
28577  "\n" \
28578  " for (k = 0; (k < givNbPart && (0 != strcmp(GIVtrPart[i].acOriPart, givTabPart[k].tcPart))); k++)\n" \
28579  " ;\n" \
28580  "\n" \
28581  " if (givNbPart == k)\n" \
28582  " doc2->value.a_classer.trpart[j].prod[0] = '\\0';\n" \
28583  " else\n" \
28584  " strcpy(doc2->value.a_classer.trpart[j].prod, givTabPart[k].tcProd);\n" \
28585  "\n" \
28586  " strcpy(doc2->value.a_classer.trpart[j].clenav, givtcCleNav[i]);\n" \
28587  " GWTTrace(GWT_NIV_FONCT, (\"Part : %s,%s\\n\", doc2->value.a_classer.trpart[j].rpart, doc2->value.a_classer.trpart[j].prod));\n" \
28588  "\n" \
28589  " if ((0 == strcmp(GIVtrPart[i].acOriPart, rPart.acOriPart)) && (0 == strcmp(GIVtrPart[i].acOriPart, giv_PJDC)))\n" \
28590  " {\n" \
28591  " /* une seule référence partenaire pour l'origine PJDC */\n" \
28592  " GWTTrace(GWT_NIV_FONCT, (\"Part pjdc double non prioritaire : %s, %s\\n\", GIVtrPart[i].acRefPart, doc2->value.a_classer.etab));\n" \
28593  " giviNbIapartPJDC++;\n" \
28594  " doc2->value.a_classer.trpart[j].iRgParent = giviNbParentPart;\n" \
28595  " doc2->value.a_classer.trpart[j].iNbParent = 1;\n" \
28596  " strcpy(givtrPart[giviNbParentPart].acOriPart, GIVtrPart[i].acOriPart);\n" \
28597  " strcpy(givtrPart[giviNbParentPart].acRefPart, GIVtrPart[i].acRefPart);\n" \
28598  " strcpy(givtrPart[giviNbParentPart].acDenom, GIVtrPart[i].acDenom);\n" \
28599  " strcpy(givtrPart[giviNbParentPart].acPrenom, GIVtrPart[i].acPrenom);\n" \
28600  " giviNbParentPart++;\n" \
28601  " j++;\n" \
28602  " }\n" \
28603  " else\n" \
28604  " {\n" \
28605  " j++;\n" \
28606  " giviNbTupleIapart = j;\n" \
28607  " }\n" \
28608  "\n" \
28609  " strcpy(rPart.acOriPart, GIVtrPart[i].acOriPart);\n" \
28610  " }\n" \
28611  " }\n" \
28612  "\n" \
28613  " GIViNbTupleIapart = giviNbTupleIapart;\n" \
28614  " }\n" \
28615  "\n" \
28616  " doc2->value.a_classer.iNbPart = GIViNbTupleIapart;\n" \
28617  " /* génération du bloc EPJ */\n" \
28618  " iCodRet = givGroupement(&buf_pos, &doc, &doc2[0], nb_inscription);\n" \
28619  " nb_inscription = 0;\n" \
28620  " iMaxBlocEcritAvant++;\n" \
28621  " }\n" \
28622  "\n" \
28623  " /* Sortie de la fonction */\n" \
28624  " return (iCodRet);\n" \
28625  "}\n";
28626 
const char * bigbuf